CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Writing registers with SPI on PIC16F639

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Tazo2006



Joined: 03 Apr 2006
Posts: 2

View user's profile Send private message

Writing registers with SPI on PIC16F639
PostPosted: Mon Apr 03, 2006 8:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 03, 2006 9:19 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Tue Apr 04, 2006 5:14 am     Reply with quote

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 Very Happy
Tazo2006



Joined: 03 Apr 2006
Posts: 2

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 7:04 am     Reply with quote

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: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 8:27 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group