Page 1 of 1

Extracting ports

Posted: Wed Apr 09, 2008 5:43 pm
by goldwingers
I need to find a solution to extracting each byte of a port ie portb,0 to portb,7.
Then i need to transmit each of these bytes to the RS232 send function as a series of data.

Can anyone help out there

Ian

Re: Extracting ports

Posted: Thu Apr 10, 2008 9:23 am
by Benj
Hello Ian

A 8 bit port eg PortB is the equivalent of a Byte of data.

4 bits = 1 nibble
8 bits = 1 byte
16 bits = 1 word or int

Therefore you can transmit it over the RS232 in one action. If you wish to split a byte into 8 bit variables then you can do the following.

Input Icon - B0 - Byte bit0
Input Icon - B1 - Byte bit1
...
Input Icon - B7 - Byte bit7

Re: Extracting ports

Posted: Thu Apr 10, 2008 10:03 pm
by goldwingers
Thanks Benj,
After putting my Q on the forum, I sussed that one out. I can now do what i need thanks.