PIC 18F4520 and EEPROM

General discussion on mikroC.
Post Reply
Author
Message
zaidgh87
Posts: 16
Joined: 22 Feb 2012 11:19

PIC 18F4520 and EEPROM

#1 Post by zaidgh87 » 22 Feb 2012 11:30

I want to save data recieved from USART in the EEPROM i've tried to read those data and to send them by USART to check if the save was correctly done ,but they was erroneous.
Plese Help me to find a solution .

//////////////////////////////////////////////////////////////////////////////////
Code
char *uart_rd ;

char *Data_eeprom ;

void main(){

UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize

while (1)
{ // Endless loop
if (UART1_Data_Ready() == 1) // If data is received,
{
uart_rd = UART1_Read(); // read the received data,
//------- EEPROM-----//
EEPROM_Write(0x80,uart_rd); // Write data to address 0x80
Data_eeprom = EEPROM_Read(0x80);
UART1_Write(Data_eeprom);

}


}
} :cry:

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: PIC 18F4520 and EEPROM

#2 Post by janko.kaljevic » 24 Feb 2012 14:09

Hello,

I have tested your code and have not encountered same behavior.
On my system everything work fine.

Please check oscillator settings in Edit Project window, or use ICD to get Data_eeprom value.

Best regards.

zaidgh87
Posts: 16
Joined: 22 Feb 2012 11:19

Re: PIC 18F4520 and EEPROM

#3 Post by zaidgh87 » 26 Feb 2012 14:45

Its my simulation i relly can't find a solution
Attachments
Simulation
Simulation
picccccccccccc.JPG (216.1 KiB) Viewed 2853 times

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: PIC 18F4520 and EEPROM

#4 Post by janko.kaljevic » 27 Feb 2012 11:09

Hello,

Please can you tell me did you tried this on actual hardware?
I have tested this chip on EasyPIC v7 and your code.

Best regards.

zaidgh87
Posts: 16
Joined: 22 Feb 2012 11:19

Re: PIC 18F4520 and EEPROM

#5 Post by zaidgh87 » 27 Feb 2012 20:32

No i'ven't tested him on hardware

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: PIC 18F4520 and EEPROM

#6 Post by janko.kaljevic » 28 Feb 2012 13:18

Hello,

Please try the same set up on hardware.

Best regards.

Post Reply

Return to “mikroC General”