Coder 0 Posted April 10, 2010 Report Share Posted April 10, 2010 Hi, there is a problem with all optimation off and the eeprom_write(). The disassembled code looks like this (optimation off): --- E:\Prg\compiler.6\picantc\libc\eeprom\eeprom.c --------------------------------------------- ... 020D 3055 MOVLW 0x55 020E 1683 BSF 0x3, 0x5 020F 1703 BSF 0x3, 0x6 0210 008D MOVWF 0xd 0211 30AA MOVLW 0xaa 0212 1683 BSF 0x3, 0x5 0213 1703 BSF 0x3, 0x6 0214 008D MOVWF 0xd ... The disassembled code for optimation on looks like this: --- E:\Prg\compiler.6\picantc\libc\eeprom\eeprom.c --------------------------------------------- ... 0111 3055 MOVLW 0x55 0112 1683 BSF 0x3, 0x5 0113 1703 BSF 0x3, 0x6 0114 008D MOVWF 0xd 0115 30AA MOVLW 0xaa 0116 008D MOVWF 0xd ... The first version don't work (EEProm not changed). Bankswitching is not needed here, but done if the optimation is off. 0212 1683 BSF 0x3, 0x5 0213 1703 BSF 0x3, 0x6 But this distroed the needed sequence (Writing to Data EEPROM Memory in the datasheet): >>Execute the special five instruction sequence: >>• Write 55h to EECON2 in two steps (first >>to W, then to EECON2) >>• Write AAh to EECON2 in two steps (first >>to W, then to EECON2) Basics: Device: PIC16F876A BoostC Optimizing C Compiler Version 6.96 (for PIC16 architecture) BoostLink Optimizing Linker Version 6.96 I switched the optimation on, but i think it should also work with optimation off. Any Idea? Greetings from Germany Coder Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.