|
|
View previous topic :: View next topic |
Author |
Message |
João Gonçalves Guest
|
write to a DSPIC port a Byte |
Posted: Wed Dec 05, 2007 12:07 pm |
|
|
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
|
|
Posted: Wed Dec 05, 2007 7:33 pm |
|
|
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 |
Posted: Thu Dec 06, 2007 3:32 am |
|
|
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
|
|
Posted: Thu Dec 06, 2007 11:14 am |
|
|
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 |
|
|
|
|
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
|