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

write to a DSPIC port a Byte

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
João Gonçalves
Guest







write to a DSPIC port a Byte
PostPosted: Wed Dec 05, 2007 12:07 pm     Reply with quote

Hello, I'm starting to use DSPICs, and I'm trying to write a byte into a port (old output_x in PICs). My question is how can i write a single byte (from x0 to x7) without changing the others register (from x8 to x15).
Thank you.
best regards,
João
Guest_7068
Guest







PostPosted: Wed Dec 05, 2007 7:33 pm     Reply with quote

You should be able to use the make16 function within the output_x function, something like:

Code:

unsigned int8 HighByte, LowByte;

output_d(Make16(HighByte,LowByte));

João Gonçalves
Guest







reply
PostPosted: Thu Dec 06, 2007 3:32 am     Reply with quote

Perhaps I didn't explain my self very well. In fact i want to do exactlly the oposite. using only 8 byte of the 16 register, whithout affecting the upper half.
Thank you
Best regards,
Ttelmah
Guest







PostPosted: Thu Dec 06, 2007 11:14 am     Reply with quote

Haven't played with the DSPic's under CCS yet, but some comments may help.
On most other 16bit chips, if you want to output a byte on a 16bit port, you do a 16bit read, modify the bits you want to send, and perform a 16bit write.
The DSPics do support an 8bit 'reverse compatible' mode for accessing single bytes, but I don't know if this works with the I/O registers. You should be able to test and find out. The #byte operator still exists, so try allocating a variable with this to the low byte register address, and see what happens!...

Best Wishes
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