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 support@ccsinfo.com

PIC24 using output_x

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







PIC24 using output_x
PostPosted: Fri Oct 09, 2009 8:31 am     Reply with quote

Hi all,

There seems to be a problem with writing bytes to output ports using the output_x function.

1 It seems to write a byte or word to a port depends on the size of the parameter (not in the manual!!!). however the default standard_oi state of changing the port to output seems to clear the tris register as a word regardless of the size of the parameter.

2 There doesnt seem to be a way to write to the top byte of the port

Is there any other function to write to the ports?

what do others do to write bytes to ports?

Thanks
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Oct 09, 2009 10:01 am     Reply with quote

Yes. The handbook clarifies about output_x():
Quote:
Output an entire word to a port. The direction register is changed in accordance with the last specified #USE *_IO directive.
In other words, using it with standard_io in effect sets the complete 16 Bit port to output.

For selective control of latch and tristate registers as required by the application, I prefer to use the respective SFR, e.g.

Code:
#word LATB = 0x2CC
#byte LATBL = 0x2CC
#byte LATBH = 0x2CD
#bit LATB12  = 0x2CC.12
LATBL=0x34;
LATB12=1;
rekinchin
Guest







PostPosted: Sun Oct 11, 2009 5:53 am     Reply with quote

my manual must be out of date it doesnt say that. It was the one i got only a month ago with the compiler upgrade. Seems little real support of the PIC24's atm. I have relready built a library of defines that give full byte and word support, would have been so easy of CCS to do that thought the compiler had been out for sometime now so strange there are so many omissions and bugs

Thanks
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