Download AVR GCC Tutorial (WinAVR)
Transcript
Some AVR compilers “cheat” somewhat, in which they do not only put on the address for a pointer, but additionally to each pointer the file place (Flash or RAM) internally secure. With call with pointer parameters apart from the address also the storage area, to which the pointer points, will then hand over to a function. This does not however only have advantages; Explanations why this like that is, lead here too far. see also: Documentation avr libc of the sections Modules/Program space stringer utilities and section Modules/Bootloader support utilities EEPROM One notes that the EEPROM memory permits only a limited number of write accesses. If one describes an EEPROM cell more frequently than the number assured in the data sheet (typical 100,000), the function of the cell is not any longer guaranteed. This applies to each individual cell. With skillful programming (e.g. ring buffer), with which the cells which can be described is regularly changed, can one a clearly higher number of write accesses, related to the overall memory, achieve. Writing and read accesses on the EEPROM memory are made by the functions defined in the module eeprom.h. With these functions individual bytes, data items know (16bit) and data blocks to be written and read. In the case of use of the EEPROM it is to be noted that before the access for this memory it is tested whether the MICROCONTROLLER locked the previous EEPROM operation. The avr libc functions contain this examination, one must it not implements. One should also prevent that that is interrupted access by the processing of an interrupt routine, there determines command successions is given, which must within fewer clock cycles sequences (“timed sequence”). Also this must be implemented on use of the functions from avr libc/eeprom.h file not. Within the functions interrupts before the “EEPROM sequence” is global deactivated and in the connection, if already switched on, new activates before. With the declaration variable in the EEPROM, is to be supplemented the attribute for the section “.eeprom”. See in addition the following example: