2008-08-04
Patch Level Update: PICC-18 STD
2008-07-29
Patch Level Update: HI-TECH C PRO for the PIC10/12/16 MCU Family
2008-07-21
NEW - PRO Compiler supporting Microchip PIC32 microcontrollers
Patch Level Update: PICC-18 STD
Patch Level Update: HI-TECH C PRO for the PIC10/12/16 MCU Family
NEW - PRO Compiler supporting Microchip PIC32 microcontrollers
Omniscient Code Generation: as featured in EDN Hot 100 Products of 2007.
|
Many PIC® processors come with on-chip Electronically Erasable Programmable Read Only Memory (EEPROM) which is typically used to store configuration data or program state. Reading, writing or pre-initialize EEPROM requires following certain steps and the compiler has addressed EEPROM access in the following ways:
Although that covers the basics
for eeprom access and save much reading of datasheets, it is a little
limiting in how it can be accessed. For example, what if you want to read
and/or write more than one byte at a time. Typically, a helper function
like this is used:
This type of function will work fine, however it is quite slow because a function call and (re)loading of EEPROM special function registers are need for each byte. Another issue is with pre-initializing EEPROM via the EEPROM_DATA macro. For multi-byte objects such as structures or floating-point numbers, pre-initialization is difficult as it is necessary to calculate what bytes make up the object and make sure they are inserted in the right order. These issues have been addressed
by the introduction of the eeprom qualifier. The eeprom qualifier
allows you to have a variable that live in eeprom and all of the hard
work is handled by the compiler.
In the above example, "eenumber" and "eestruct" are EEPROM variables which are automatically allocated read and written by the compiler. As shown with eenumber above, pre-initialization becomes a simple assignment. Similarly, storing of multi-byte objects to EEPROM becomes a "one-liner". This is demonstrated where the ram structure "ramstruct" is assigned to "eestruct". Additionally, the reading/writing is done in bulk and so should be much faster. Look out for the eeprom qualifier in the latest PIC compilers (HI-TECH PICC™, HI-TECH PICC-18™ and HI-TECH C for dsPIC/PIC24) from HI-TECH Software.
|
Copyright © 2008 HI-TECH Software • Trademarks • Forum
Site Map