Sherry1
Member level 3
- Joined
- Apr 4, 2013
- Messages
- 61
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Manchester, UK
- Activity points
- 1,810
Your Compiler is C32 or C18?
The addresses will be in the hex file. This might help you. https://www.kanda.com/blog/microcontrollers/pic-microcontrollers/pic-hex-file-format/
rom near unsigned char con_flag;
static byte CheckState;
char *a = &con_flag;
memcpypgm2ram ((void*)&CheckState, (const rom void*)con_flag, sizeof(byte));
if ( CheckState == 0x01){
return TRUE;
}
else {
return FALSE;
}
CheckState = 0x01;
memcpyram2pgm ((rom void*)con_flag, (void*)&(CheckState), sizeof(byte));
unsigned char CheckState = 0;
ReadFlash(0x07070, 1,(unsigned char *) CheckState);
if ( CheckState != 0x01 ){ // modem NOT_CONFIGURED
//execute instructions to
//Change Configuration Flag
CheckState = 0x01;
WriteBytesFlash ((0x07070, 1, (unsigned char *) CheckState));
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 unsigned char CheckState; ReadFlash(0x07070, 1, &CheckState); if ( CheckState != 0x01 ){ // modem NOT_CONFIGURED //execute instructions to //Change Configuration Flag CheckState = 0x01; WriteBytesFlash(0x07070, 1, &CheckState); }
extern void ReadFlash(unsigned long startaddr, unsigned int num_bytes, unsigned char *flash_array);
#endif
#if defined (FLASH_V1_1) || defined (FLASH_V1_2) || defined (FLASH_V1_3) || defined (FLASH_V1_4) \
|| defined (FLASH_V1_5) || defined (FLASH_V1_6) || defined (FLASH_V2_1)
extern void EraseFlash(unsigned long startaddr, unsigned long endaddr);
extern void WriteBlockFlash(unsigned long startaddr, unsigned char num_blocks, unsigned char *flash_array);
extern void WriteBytesFlash(unsigned long startaddr, unsigned int num_bytes, unsigned char *flash_array);
#if defined (FLASH_V2_1)
extern void WriteWordFlash(unsigned long startaddr, unsigned int data);
#endif
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 unsigned char CheckState; unsigned char *ptr2CheckState = &CheckState; ReadFlash(0x07070, 1, *ptr2CheckState); if ( CheckState != 0x01 ){ // modem NOT_CONFIGURED //execute instructions to //Change Configuration Flag CheckState = 0x01; WriteBytesFlash(0x07070, 1, *ptr2CheckState); }
rom near unsigned char CheckState;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?