// 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
Re: built-in function
Posted: Mon Jul 28, 2003 9:01 am
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
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