Below is a piece of Basic code to create a block check character used in a serial comms program I use. I am slowly converting the program into B4a.
Could someone give me a helpig hand.
A set of characters are inputted to send to a serial device. A block check character is added to the end of message. The other device uses the same logic to check the message.
REM Create Block Check Character
I%=0
BC%=0
REPEAT
I%=I%+1
A%=ASC(MID$(CMD$,I%,1))
X%=BC% AND A%
X%= NOT X%
BC%=BC% OR A%
BC%=BC% AND X%
UNTIL I%=LEN(CMD$)
Thanks in anticipation,
Bernard
Could someone give me a helpig hand.
A set of characters are inputted to send to a serial device. A block check character is added to the end of message. The other device uses the same logic to check the message.
REM Create Block Check Character
I%=0
BC%=0
REPEAT
I%=I%+1
A%=ASC(MID$(CMD$,I%,1))
X%=BC% AND A%
X%= NOT X%
BC%=BC% OR A%
BC%=BC% AND X%
UNTIL I%=LEN(CMD$)
Thanks in anticipation,
Bernard