View previous topic :: View next topic |
Author |
Message |
JackVandaL
Joined: 13 Nov 2007 Posts: 2
|
General Help |
Posted: Wed Nov 14, 2007 3:38 pm |
|
|
Hello all,
I started working on a project that is using Microchips's PIC18F2455 and 24LC64 EEPROM. I've read the tech docs, browsed around MicrochipC.com and set up my circuit. However, I'm new to coding PICs using C and I was wondering if anyone could point out a good tutorial or sample code that sets up a basic interaction between a PIC and an EEPROM. For example, the PIC stores a bit sequence to the EEPROM and then wait a little then reads the sequence back and displays it using LEDs.
Any advice is appreciated.
Thanks,
JV |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Nov 14, 2007 3:49 pm |
|
|
A good thing the CCS compiler comes with loads of examples and drivers.
Have a look at EX_EXTEE.c in the c:\program files\PICC\examples
With this example you can connect your PIC to a terminal program on your PC (Hyperterm for example) and then use the Read or Write commands to send to / read from the EEPROM.
Don't forget to change the include of 2416.c to 2464.c for your EEPROM. |
|
|
JackVandaL
Joined: 13 Nov 2007 Posts: 2
|
|
Posted: Wed Nov 14, 2007 4:30 pm |
|
|
Thanks I looked over it, but when I say new I mean COMPLETELY new. Is there anything else like a tutorial that kind of walks through everything. Maybe it would help if I could look at the 2464.c code. Where is that located?
Also I guess I need to change 16F84.H to something else?
What does this do:
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_A3, rcv=PIN_A2)
Sorry if this is all dumb questions |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Nov 15, 2007 10:28 am |
|
|
If you're brand spanking new to PIC's then I would suggest you start with something extremely basic. I remember when I first started, I had to learn things all over again. I was used to the 80C51 series and needed to learn the little 'quirks' of the PIC.
I would suggest you write a little program that simply blinks an LED that is tied to one pin. Play with the delays to adjust the timing. Then, I would suggest you switch to using one of the timers to control the blink rate. After that, you might want to interface the PIC with a PC and try sending data to/from the PIC. Once you get this running then you could start playing with the eeprom. Having a connection to a PC will enable you to store data to the eeprom and then read it back. The PIC can then send the data that was received to the PC for verification.
Take whatever steps you want but I would suggest you start out with the most simplest test that you can and build on that. We've all been there so don't worry about asking 'stupid' questions. The only stupid question is the one that isn't asked. If you want to learn there are a lot of good knowledgable people here willing to help.
As for your current questions, #use delay() tells the compiler what speed your crystal or internal oscillator is running at. This helps it put the correct code in to give accurate timing for delay commands and also sets up the serial port timing.
#use rs232 tells the compiler what speed the serial port will run at and what pins to use for RXD and TXD. This also has other options available that can be added, depending on what you need.
Ronald
When the remote control batteries begin to die, why do we try pushing harder on the buttons? |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Nov 15, 2007 1:03 pm |
|
|
Quote: |
When the remote control batteries begin to die, why do we try pushing harder on the buttons?
|
Ehh..?? are you sure? pls dont´t tell me that IR beam intensity do not increase pushing
the buttons harder!!
Humberto
Nice comment Ronald |
|
|
|