- Sat Sep 17, 2016 6:51 pm
#55305
Thank you for your response.
The code for test the device is:
cls
memclear
dim cmd(25)
baudrate 115200
serialflush
cmd(0)=hextoint("55")
cmd(1)=hextoint("AA")
cmd(2)=hextoint("24")
cmd(3)=hextoint("01")
cmd(4)=hextoint("02")
cmd(5)=hextoint("00")
cmd(6)=hextoint("01")
for j=7 to 21
cmd(j)=hextoint("00")
next j
cmd(22)=hextoint("27")
cmd(23)=hextoint("01")
for k=0 to 23
serialprint chr(cmd(k))
next k
delay 100
timeini = millis()
cant_car = 0
[serialin1]
timeini1 = millis()
cant_car = cant_car + 1
bla$ = Serial.read.chr()
dat = asc(bla$)
dat1$ = upper(hex(dat))
if len(dat1$) = 1 then dat1$ = "0" & dat1$
delayed = millis() - timeini1
wprint "Hex Code received: " & dat1$ & " - delay: " & str(delayed) & " msec"
print
if serial.available() <> 0 then goto [serialin1]
print
delayed = millis() - timeini
wprint str(cant_car) & " characters in " & str(delayed) & " msec"
end
The response from the device and delays are:
Hex Code received: AA - delay: 325 msec
Hex Code received: 55 - delay: 322 msec
Hex Code received: 24 - delay: 323 msec
Hex Code received: 01 - delay: 325 msec
Hex Code received: 04 - delay: 325 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 324 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 00 - delay: 328 msec
Hex Code received: 00 - delay: 325 msec
Hex Code received: 00 - delay: 326 msec
Hex Code received: 28 - delay: 324 msec
Hex Code received: 01 - delay: 125 msec
24 characters in 14051 msec
Done.
I sent 24 hexadecimal characters very quick but to receive 24 characters in 14051 msec is very slow.
Any idea how to reduce the delay?
Thank you