I am trying to readin 6bytes using serrxd with a qualifyer.
It is almost working, but I have to send the data 2 times before anything happens, and the last few bits are wrong.
I am using AiTerm to send the data "raw".
%01110111 %11111111 %00000000 %11111111 %00000000 %11111111 %00000000 CR LF
tried without CR LF too.
I am using a serial port monitor to see what is sent, and the AiTerm sends the same data each time, so its not some termination thats missing.
My code
<code><pre><font size=2 face='Courier'>
for b10 = 0 to 10
sertxd("LOADING ...",#b10,13,10)
toggle 2
pause 1000
next
disconnect
readserial:
do
;12leds á 4 bits = 48bits / 8 = 6bytes
SERRXD [5000,timedout],(119),b1,b2,b3,b4,b5,b6
toggle 2
b0=b1
sertxd("LED 1 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 2 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b2
sertxd("LED 3 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 4 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b3
sertxd("LED 5 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 6 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b4
sertxd("LED 7 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 8 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b5
sertxd("LED 9 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 10 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b6
sertxd("LED 11 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 12 = ",#bit3,#bit2,#bit1,#bit0,13,10)
loop
timedout:
for b10=0 to 20
toggle 2
pause 100
next
GOTO readserial
</font></pre></code>
Log from AiTerm
<code><pre><font size=2 face='Courier'>
(Loading...)
LED 1 = 1111
LED 2 = 1111
LED 3 = 1000
LED 4 = 0000
LED 5 = 0000
LED 6 = 0000
LED 7 = 1111
LED 8 = 1111
LED 9 = 1000
LED 10 = 0000
LED 11 = 0100
LED 12 = 0011
</font></pre></code>
So already at the second byte theres wrong bits.
Any ideas ?
Edited by - MORA99 on 10/07/2007 01:18:22
It is almost working, but I have to send the data 2 times before anything happens, and the last few bits are wrong.
I am using AiTerm to send the data "raw".
%01110111 %11111111 %00000000 %11111111 %00000000 %11111111 %00000000 CR LF
tried without CR LF too.
I am using a serial port monitor to see what is sent, and the AiTerm sends the same data each time, so its not some termination thats missing.
My code
<code><pre><font size=2 face='Courier'>
for b10 = 0 to 10
sertxd("LOADING ...",#b10,13,10)
toggle 2
pause 1000
next
disconnect
readserial:
do
;12leds á 4 bits = 48bits / 8 = 6bytes
SERRXD [5000,timedout],(119),b1,b2,b3,b4,b5,b6
toggle 2
b0=b1
sertxd("LED 1 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 2 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b2
sertxd("LED 3 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 4 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b3
sertxd("LED 5 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 6 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b4
sertxd("LED 7 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 8 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b5
sertxd("LED 9 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 10 = ",#bit3,#bit2,#bit1,#bit0,13,10)
b0=b6
sertxd("LED 11 = ",#bit7,#bit6,#bit5,#bit4,13,10)
sertxd("LED 12 = ",#bit3,#bit2,#bit1,#bit0,13,10)
loop
timedout:
for b10=0 to 20
toggle 2
pause 100
next
GOTO readserial
</font></pre></code>
Log from AiTerm
<code><pre><font size=2 face='Courier'>
(Loading...)
LED 1 = 1111
LED 2 = 1111
LED 3 = 1000
LED 4 = 0000
LED 5 = 0000
LED 6 = 0000
LED 7 = 1111
LED 8 = 1111
LED 9 = 1000
LED 10 = 0000
LED 11 = 0100
LED 12 = 0011
</font></pre></code>
So already at the second byte theres wrong bits.
Any ideas ?
Edited by - MORA99 on 10/07/2007 01:18:22