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

How to get determine the value of an output port (SOLVED)

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



Joined: 01 Dec 2010
Posts: 4

View user's profile Send private message

How to get determine the value of an output port (SOLVED)
PostPosted: Wed Dec 01, 2010 9:29 am     Reply with quote

Assuming PORT B is outputting 0xFF. How can I read the status of PORT B so I could determine the output state?

Sorry for being such a noob in CCSC but CCSC doesn't seem to recognize PORTB keyword.


Last edited by ambokyo on Thu Dec 02, 2010 6:27 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19227

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 9:40 am     Reply with quote

Multiple parts:

If you have just output '0', then you already know what has been output.....

If you are using 'fast_io' mode, then input_b() returns the state of the port.

Input_state returns the state of a pin, without changing the port direction.

Normally the input instruction _will_ set the port as an input automatically.

You can define PORTB as a variable mapped to the output latch, using #byte.

If you have the IDE, then 'tools', 'device editor', 'registers', 'make include file', will automatically build a file with all the registers and bits defined for you.

Best Wishes
ambokyo



Joined: 01 Dec 2010
Posts: 4

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 6:29 am     Reply with quote

Thanks so much.

#byte and #bit is exactly what I was looking for.
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