Therefore this last vector whole will be which can operate, and it assigned to the first vector numbers so that it could continue the increases from where it was going.
Eeprom Software How To ReadWrite DataRead up about this project on EEPROM: How To ReadWrite Data With PSoC5 LP PSoC Latinoamrica 8 4,483 Overview Things Story Introduction Hardware Software Schematics Code Credits Comments (0) Share on Facebook Share on LinkedIn Share on Pinterest Share on Reddit Share on Twitter Embed data-htmltrue data-placementbottom data-togglepopover data-triggerclick Team PSoC Latinoamrica: Brayan Andrs Bermdez, Edgard Daniel Ucha Published October 30, 2016 GPL3 EEPROM: How To ReadWrite Data With PSoC5 LP Easy and optimal way to write and read data in the EEPROM memory of PSoC5LP.It is here where EEPROM memories come in our rescue, as we know it can be erased electrically and retain data even if power is gone.In every memory direction there is a data, then this way, and looking at the figure as an example, we see the following: Address: 000 - Data:0100 Address: 001 - Data:0011 Address: 010 - Data:1000 Etc.Note that the addresses are in binary format but may be in hexadecimal or integer values, sometjing that does not happen with the data, data are stored in the memory in a binary form, as mentioned before for this project will be 8 bits long, but PSoC5LP EEPROM saves more than 1 byte per address. Our recommendation is to compare the data to be saved with the ASCII table on hand so we can treat part by part of the data to be stored in 8-bit EEPROM memory, and they are saved in different addresses of the EEPROM, as we do here. Project that we will build is a simple 4 digit counter, we will use a pulse generated by a PWM along with the use of an interruption it will increase the counter digit by digit, it is done this way because as stated above we will compare each digit with the ASCII table and save the characters in each position of the EEPROM memory, therefore we will use four memory locations to store our 4-digit counter. Once you remove power to our counter, the last count value will be saved in the memory, so when you re-energize, the counter restarts from the value where it has been previously, thanks to the reading of this value stored in the EEPROM memory. Eeprom Software How To Handle DataThe General Target will be to learn to Read and Write data within EEPROM memory Once we are sure on how to handle data writingreading,we will be able to do more complex data operations and of any type in general. Remember our recommendation on using a ASCII table. ![]() We need to show the data, for this we will use the LCD Custom component, where we can assign the pins to where we want, each output pin of the LCD Custom is assigned to a strong drive pin and is assigned with names so as not to get confused. This component can be downloaded at the end of the article and will have to be added manually. We also need the EEPROM memory block, no need to configure anything, everything for this EEPROM memory block is all done by software, it will be enough then to include the EEPROM memory block to the schematic diagram. Finally we add a reset button, it is external only to show that also it also works, the pin must be configured as input pull-up resistive and leads to an interruption on rising edge. This reset will simply write zeros in the EEPROM memory and restart the program to start at count 0. What to do before you compile this program: There is a work around the compiler so sprintf can operate correctly. Software As it had already been explained, it is a project that is based more on software then hardware, so will give the complete description of the algorithm and leave the software well commented so you can understand what the code is doing: The first thing done was to start from the interruption generated by the PWM, in the method used for interrups, increase rules are made, split up the 4 digits of the counter and assign them to a 4 position vector. Each time an interruption is generated the rules of increase digits are followed, thus completing the 4 digit counter, from 0 to 9999. Following this, in the same method of interruption, it makes the conversion of the vectors of integers to vectors of characters (ASCII), necessary to be able to store in the EEPROM memory, what follows is writing in the EEPROM memory using the following statement: writeStatusEEPROMWriteByte(numaimp3,0). This instruction receives two parameters, the first one is the data to written, in this case will be a character of 8 bits to be stored. The second parameter refers to the address, or direction, as said at the beginning its in a binary form but you could write the equivalent in interger format. For this project we will use the memory addresses 0, 1, 2 and 3. The code takes care of storing the 4 digits In the method of initialization is added the lines that are used for reading the EEPROM memory which are: readiEEPROMReadByte(i). But this vector reading would not be useful because we cannot make operations with it, therefore we changed character to an integer.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |