Hi I try to read the flash ROM of my PIC16F916 to calculate a checksum. I use the MPLAB and the PICC v9.83 Compiler. I tried this c function: unsigned int ReadFlash( unsigned int address ) { EEADRL =3D address%256; EEADRH =3D address/256; EEPGD =3D 1; // program memory RD =3D 1; // read ; ; return EEDATH*256 + EEDATL; } and everything in assembler: unsigned char low3; unsigned char high3; unsigned int dataFlash; void main() { #asm BCF _STATUS, 5 BCF _STATUS, 6 MOVF _low3, W BSF _STATUS, 6 MOVWF _EEADR BCF _STATUS, 6 MOVF _high3, W BSF _STATUS, 6 MOVWF _EEADRH BSF _STATUS, 5 BSF _EECON1, 7 BSF _EECON1, 0 NOP NOP BCF _STATUS, 5 MOVF _EEDATH, W MOVWF _dataFlash+1 CLRF _dataFlash MOVF _EEDATA, W IORWF _dataFlash, F MOVLW 0=20 IORWF _dataFlash+1, F #endasm } But both are not working, if I debug it most of the time the register EEDAT= A and EEDATH have the right value. But if I copy it to the variable dataFlash it is 0. With the mikroC compiler is a function to read the flash that works. But I can not use this compiler because the build hex file is much bigger and has no space on the PIC. Any idea what is wrong or how I can read the flash ROM? thanks Adrian --=20 View this message in context: http://old.nabble.com/Read-Flash-of-PIC16F916= -tp33623645p33623645.html Sent from the PIC - [PIC] mailing list archive at Nabble.com. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .