Actually, Steve (Mister e) understood what I was referring to. Here is the long story. I have a 16F870 monitoring 16 inputs and I am sending the status of all inputs wirelessly to a 18F4550. Then, the 18F4550 outputs the status through USB into VB6. Anyway, because of my limitation in PBP, I can't send word variables wirelessly so I am sending 4 bytes which covers the 16 inputs. On the transmitter side, my code looks like this...it's a portion of the code...and don't forget, it may not be efficient because I am not very proficient in PBP.
if PORTA.5=0 THEN
B1=0
ELSE
B1=1
ENDIF
if PORTA.2=0 THEN
B2=0
ELSE
B2=1
ENDIF
if PORTA.1=0 THEN
B3=0
ELSE
B3=1
ENDIF
if PORTA.0=0 THEN
B4=0
ELSE
B4=1
ENDIF
C1=(B1*1)+(B2*2)+(B3*4)+(B4*8)
This was the easy part. One the receiver side, it looks like this:
in1=c1.0
in2=c1.1
in3=c1.2
in4=c1.3
And then from here it sends the data to VB6. I wasn't aware that PBP stored the numbers as binary and that is where my confusion was. When sending the numbers over the data link, it is simply sent as (C1=9) or (C1=15), not (c1=%00001011). Furthermore, I never knew that you can use a c1.0 or c1.3 to take a portion of the number.
Previously, I was sending 4 bytes for each specific number so it was taking 96 bytes (when you include the start and end bit) to update all 16 inputs. Now, it only takes 6 bytes to send that data.
Thanks to all who helped.
Chris
Bookmarks