• AVR Freaks

Hot!External EEPROM(ATC024) interface with PIC24EP256GP206

Page: < 12 Showing page 2 of 2
Author
ric
Super Member
  • Total Posts : 23820
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/20 01:49:37 (permalink)
0
That code writes to the chip as soon as you run it.
How did you test if the data survives a power cycle?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#21
Gouthami c v
Starting Member
  • Total Posts : 78
  • Reward points : 0
  • Joined: 2019/07/11 01:55:44
  • Location: 0
  • Status: offline
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/20 03:39:04 (permalink)
0
After write code into chip i have checked output in uart and oscilloscope, in uart it displaying A to Z characters when i power it off it start displaying from A instead of where it has stop i have checked only this.
what else should i check could you please tell me
 
Thankyou.
#22
ric
Super Member
  • Total Posts : 23820
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/20 03:45:40 (permalink)
5 (1)
I don't understand your explanation.
If you power cycle the PIC, it will start running your code from the start again.
As I just explained, that will immediately overwrite what you put into the EPROM.
 
 I think you are making some very bad assumption about something.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#23
davekw7x
Entropy++
  • Total Posts : 1827
  • Reward points : 0
  • Joined: 2012/01/16 12:01:07
  • Location: Second star on the right, straight on till morning
  • Status: offline
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/20 09:02:22 (permalink)
0
Gouthami c v
...what else should i check...



There are three things at least as important as writing code for an application:
  1. Testing
  2. Testing
  3. TESTING

I simply never (that's NEVER) write a single line of code for a new project until I have formulated a test plan.  I don't always formalize it with external documentation, but I always (that's ALWAYS) know how I am going to test it before actually starting.  Period.  Full stop.
 
For testing EEPROM, when you want to make sure the EEPROM retains last values written from a previous run, here's a REALLY BIG DEAL:
When you program with a PICkit3 (maybe other programmers as well), the device may be reset several times before programming is complete.  The device will begin to run each time and then be reset again, and that may disturb previous conditions.

Therefore, upon startup, before writing to EEPROM:
I always give it a delay of a second or so to make sure previous values are still in the EEPROM when it starts running "for real."

Here's my test program for byte-at-a time writing:

[/Begin Quasi-code for main()]
  • Begin main()   
  •     Initialize everything that needs to be initialized.
  •     Set the 9-bit byte address to zero (or whatever other address you want to start at).
  •     Begin Main loop
  •         Delay for a second or two.  Maybe __delay_ms(1000) or some such thing.
  •         Read and print old data value at the byte address.
  •         Change the data to something else.
  •         Write the new data to the same byte address. Print what you are writing.
  •         Do ACK Polling to make sure EEPROM internal write cycle has finished.
  •         Read and print the new data value.
  •         Change the byte address.  Maybe just increment it.
  •     End of Main loop
  • End of main()
[/End Quasi-code for main()]

Here is the output from my test program.
I reset or power-cycled the circuit after four times through the loop each time.
You can start at some other address.  You can let it go as long as you want.
The important point is that as you begin each time you can compare the value with the last thing you wrote at each address.
Note that I always print some information before entering the main loop.  That makes it easy to see where it gets reset.
I printed out the loop count and the byte address followed by old and new data each time through the loop

Compiled on Sep 20 2019 at 08:51:20 by XC16 version 1040
1: 0x000
  eedata    = 0xA8
  Writing     0xAA
  New value = 0xAA
2: 0x001
  eedata    = 0xEE
  Writing     0xF1
  New value = 0xF1
3: 0x002
  eedata    = 0x36
  Writing     0x3A
  New value = 0x3A
4: 0x003
  eedata    = 0x6B
  Writing     0x70
  New value = 0x70

Compiled on Sep 20 2019 at 08:51:20 by XC16 version 1040
1: 0x000
  eedata    = 0xAA
  Writing     0xAC
  New value = 0xAC
2: 0x001
  eedata    = 0xF1
  Writing     0xF4
  New value = 0xF4
3: 0x002
  eedata    = 0x3A
  Writing     0x3E
  New value = 0x3E
4: 0x003
  eedata    = 0x70
  Writing     0x75
  New value = 0x75

Compiled on Sep 20 2019 at 08:51:20 by XC16 version 1040
1: 0x000
  eedata    = 0xAC
  Writing     0xAE
  New value = 0xAE
2: 0x001
  eedata    = 0xF4
  Writing     0xF7
  New value = 0xF7
3: 0x002
  eedata    = 0x3E
  Writing     0x42
  New value = 0x42
4: 0x003
  eedata    = 0x75
  Writing     0x7A
  New value = 0x7A


Regards,

Dave


post edited by davekw7x - 2019/09/20 11:09:23

Sometimes I just can't help myself...
#24
Gouthami c v
Starting Member
  • Total Posts : 78
  • Reward points : 0
  • Joined: 2019/07/11 01:55:44
  • Location: 0
  • Status: offline
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/22 22:05:12 (permalink)
0
Thank you for replaying,i'll follow your steps.
I have one thing to ask that how to write delay for this pic(24ep256gp206)because i have included header file #include <libpic30.h>  //for delay routines 
I have used below delay function but i am getting error,

 
__delay_ms(20); 
 

the error i got

 
build/default/production/newmain.o(.text+0x76): In function `.L9':
: undefined reference to `___delay_ms'
build/default/production/newmain.o(.text+0x9c): In function `.L5':
: undefined reference to `___delay_ms'
build/default/production/newmain.o(.text+0xba): In function `.L8':
: undefined reference to `___delay_ms'
make[2]: *** [dist/default/production/LEDBRIGHTNESS.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
 

could you please help me for how to use delay functions for pic24e.
Thanking you.
#25
ric
Super Member
  • Total Posts : 23820
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/22 22:13:34 (permalink)
0
It sounds like you neglected to define FCY.
Read the documentation for __delay_ms() in
C:\Program Files (x86)\Microchip\xc16\v1.33\docs\16-Bit_Language_Tools_Libraries_Manual.pdf
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#26
Gouthami c v
Starting Member
  • Total Posts : 78
  • Reward points : 0
  • Joined: 2019/07/11 01:55:44
  • Location: 0
  • Status: offline
Re: External EEPROM(ATC024) interface with PIC24EP256GP206 2019/09/22 22:17:17 (permalink)
0
Yes  i have used fcy as fp so
#define FP 3685000UL
now i have changed to FCY now it's working thank you ric's.
#27
Page: < 12 Showing page 2 of 2
Jump to:
© 2019 APG vNext Commercial Version 4.5