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

built-in function

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







built-in function
PostPosted: Mon Jul 28, 2003 7:41 am     Reply with quote

// portB is 8 x output
#byte portb = 0x06
portB = portB - 2

This part is working correctly. But is there any
nicer C-like function for this part (portB = portB - 2)?

Thanks Chris Burger.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516431
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

Re: built-in function
PostPosted: Mon Jul 28, 2003 9:01 am     Reply with quote

The PIC is a Harvard architecture device. Also the IO ports are all register mapped. The #byte portb=0x06 mapps the variable portb to the register associated with the physical port.
Writing to the register this way means you have to be aware of the direction input or output of the physical register which has advantages but maybe you just want to send data in and out the port with in out type functions.

If so, use another variable say my_variable and the built in functions input_x output_x where x is the specific port.

int8 my_variable;
my_variable=my_variable-2;
output_b(my_variable);
my_variable=input_b();
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516436
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