View previous topic :: View next topic |
Author |
Message |
Tazo2006
Joined: 03 Apr 2006 Posts: 2
|
Writing registers with SPI on PIC16F639 |
Posted: Mon Apr 03, 2006 8:20 pm |
|
|
Hi all..
My question is how can I write the configuration registers on PIC16F639?
Can I just put the code SPI_WRITE (value) and SPI_WRITE2 (value)?
But in the datasheet is shown that the code have 16 bit
The 3 first MSB is the code to read or write
The next 4 is the location of the register
the next 8 is the configurations, and the last is the parity bit
But the command SPI_WRITE just accept 8 bits, how can I do?
Thank you |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Mon Apr 03, 2006 9:19 pm |
|
|
I think you're confusing the purpose of SPI_WRITE(). That function is for writing data out the hardware SPI pin of the PIC. To set configuration registers you should be able to do most everything with inherent SETUP commands.
Look at the the 16F639.h file in the DEVICES folder. It will give you an idea of some of the possibilities. Also look at the compiler manual.
If you have specific questions regarding accessing a certain configuration register then re-post with some more detail.
John |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Apr 04, 2006 5:14 am |
|
|
I believe he is talking about writing to "some" external device through the SPI. He didn't mention the "other" device and his wording makes it sound as though he is trying to write to the PIC. To the poster, here's a hint: 8 + 8 = 16 |
|
|
Tazo2006
Joined: 03 Apr 2006 Posts: 2
|
|
Posted: Tue Apr 04, 2006 7:04 am |
|
|
I just want to know how to write the configuration registers in pic16f639.
Here�s the datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/41232B.pdf on page 105.
I think this is to write the pic16f639 registers using an external device, but how can I program it directly using ccs compiler?
Thank you. |
|
|
drh
Joined: 12 Jul 2004 Posts: 193 Location: Hemet, California USA
|
|
Posted: Tue Apr 04, 2006 8:27 am |
|
|
Read the NOTE on page 112 of the device data sheet. You can only program the configuration bits with a device programmer. You put this information into your source files with the #FUSES pre-processor directive. _________________ David |
|
|
|