//EEPROM0: //Macro implementations
char FCD_EEPROM0_EEPROMRead(short addr)
{
//This licence of FlowCode does not produce code for this component
#pragma message EEPROM0: This licence of FlowCode does not produce code for this component
return (0);
}
void FCD_EEPROM0_WriteEEPROM(short addr, char data)
{
}
unsigned char ReadEEPROM(unsigned char address){
eecon1=0; //ensure CFGS=0 and EEPGD=0
eeadr = address; //setup address
eecon1.RD = 1; //do actual read
return(eedata); //and return data
}
void WriteEEPROM(unsigned char address,unsigned char data){
char SaveInt;
SaveInt=intcon; //save interrupt status
eecon1=0; //ensure CFGS=0 and EEPGD=0
eecon1.WREN = 1; //enable write to EEPROM
eeadr = address; //setup Address
eedata = data; //and data
intcon.GIE=0; //No interrupts
eecon2 = 0x55; //required sequence #1
eecon2 = 0xaa; //#2
eecon1.WR = 1; //#3 = actual write
intcon=SaveInt; //restore interrupts
while(!pir2.EEIF); //wait until finished
eecon1.WREN = 0; //disable write to EEPROM
}
Are my post invisible or something?
Mike.
char FCD_EEPROM0_EEPROMRead(short [COLOR="red"]addr[/COLOR])
{
eecon1=0; //ensure CFGS=0 and EEPGD=0
eeadr = [COLOR="red"]address[/COLOR]; //setup address
eecon1.RD = 1; //do actual read
return(eedata); //and return data
}
void FCD_EEPROM0_WriteEEPROM(short [COLOR="red"]addr[/COLOR], char data)
{
char SaveInt;
SaveInt=intcon; //save interrupt status
eecon1=0; //ensure CFGS=0 and EEPGD=0
eecon1.WREN = 1; //enable write to EEPROM
eeadr = [COLOR="red"]address[/COLOR]; //setup Address
eedata = data; //and data
intcon.GIE=0; //No interrupts
eecon2 = 0x55; //required sequence #1
eecon2 = 0xaa; //#2
eecon1.WR = 1; //#3 = actual write
intcon=SaveInt; //restore interrupts
while(!pir2.EEIF); //wait until finished
eecon1.WREN = 0; //disable write to EEPROM
}
The only errors I get are,
C:\Projects\BoostC\Flowcode.c(516:10): error: unknown identifier 'address'
C:\Projects\BoostC\Flowcode.c(516:10): error: invalid operand 'address'
C:\Projects\BoostC\Flowcode.c(516:8): error: failed to generate expression
C:\Projects\BoostC\Flowcode.c(528:10): error: unknown identifier 'address'
C:\Projects\BoostC\Flowcode.c(528:10): error: invalid operand 'address'
C:\Projects\BoostC\Flowcode.c(528:8): error: failed to generate expression
And these are caused by a mismatch in the routines I posted.
The bits in red have to match so change them all to either addr or address.Code:char FCD_EEPROM0_EEPROMRead(short [COLOR=red]addr[/COLOR]) { eecon1=0; //ensure CFGS=0 and EEPGD=0 eeadr = [COLOR=red]address[/COLOR]; //setup address eecon1.RD = 1; //do actual read return(eedata); //and return data } void FCD_EEPROM0_WriteEEPROM(short [COLOR=red]addr[/COLOR], char data) { char SaveInt; SaveInt=intcon; //save interrupt status eecon1=0; //ensure CFGS=0 and EEPGD=0 eecon1.WREN = 1; //enable write to EEPROM eeadr = [COLOR=red]address[/COLOR]; //setup Address eedata = data; //and data intcon.GIE=0; //No interrupts eecon2 = 0x55; //required sequence #1 eecon2 = 0xaa; //#2 eecon1.WR = 1; //#3 = actual write intcon=SaveInt; //restore interrupts while(!pir2.EEIF); //wait until finished eecon1.WREN = 0; //disable write to EEPROM }
Mike.
char FCD_EEPROM0_EEPROMRead([COLOR="red"]char[/COLOR] addr)
{
eecon1=0; //ensure CFGS=0 and EEPGD=0
eeadr = address; //setup address
eecon1.RD = 1; //do actual read
return(eedata); //and return data
}
void FCD_EEPROM0_WriteEEPROM([COLOR="red"]char [/COLOR]addr, char data)
{
char SaveInt;
SaveInt=intcon; //save interrupt status
eecon1=0; //ensure CFGS=0 and EEPGD=0
eecon1.WREN = 1; //enable write to EEPROM
eeadr = address; //setup Address
eedata = data; //and data
intcon.GIE=0; //No interrupts
eecon2 = 0x55; //required sequence #1
eecon2 = 0xaa; //#2
eecon1.WR = 1; //#3 = actual write
intcon=SaveInt; //restore interrupts
while(!pir2.EEIF); //wait until finished
eecon1.WREN = 0; //disable write to EEPROM
}
Well, you can probably get rid of some by changing it to,
Mike.
Line 517
eecon1.RD = 1; //do actual read
Line 527
eecon1.WREN = 1; //enable write to EEPROM
Line 530
intcon.GIE=0; //No interrupts
Line 533
eecon1.WR = 1; //#3 = actual write
Line 535
while(!pir2.EEIF); //wait until finished
Line 536
eecon1.WREN = 0; //disable write to EEPROM
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?