Greetings to the Team of Specialists.
[ Post also open on the FR-Forum at http://www.picaxeforum.co.uk/showthread.php?29927-Commande-SERIN-dans-le-module-AXE133Y-(Serial-OLED-display-interface) ].
I look at the serial interface code for OLED display "AXE133Y" and I have a problem understanding with the Serin command as used here.
Source: http://www.picaxe.com/downloads/axe133y.bas.txt
Suppose that the MCU of the main system sends to the Serial interface the command [Serout C.4, Baud, (254, 192) '' Line Position.2, Col.1]
Therefore, 2 bytes (254 and 192) are sent here. The first to say "This is a command" and the second "to specify the code for this command: Position = Line2 / Column 1".
On the Serial Interface side, which receives this information, these two bytes must be processed.
Why does the Serial interface code use the [Serin RX, Baud, b1] command and not a [Serin RX, Baud, b1, b2] command to store the 2 bytes to be processed at one time ?
Also, is not the Serin command "blocking"?
That is, it would remain waiting for the bytes transmitted by serout (but which is only executed ONE time).
In my mind, the Serin command, placed at the beginning of the Main loop, as used here, will place the first byte in b1 but once this is done, the 2nd byte will be permanently lost and I do not see how the following Serin command , Placed lower in the conditional loop, will catch anything since there will be only ONE Serout transmitted and ALREADY read and that this Serout will have been sent only once and not renewed when This second Serin will arrive !?
Thank you for your help.
[ Post also open on the FR-Forum at http://www.picaxeforum.co.uk/showthread.php?29927-Commande-SERIN-dans-le-module-AXE133Y-(Serial-OLED-display-interface) ].
I look at the serial interface code for OLED display "AXE133Y" and I have a problem understanding with the Serin command as used here.
Source: http://www.picaxe.com/downloads/axe133y.bas.txt
Suppose that the MCU of the main system sends to the Serial interface the command [Serout C.4, Baud, (254, 192) '' Line Position.2, Col.1]
Therefore, 2 bytes (254 and 192) are sent here. The first to say "This is a command" and the second "to specify the code for this command: Position = Line2 / Column 1".
On the Serial Interface side, which receives this information, these two bytes must be processed.
Why does the Serial interface code use the [Serin RX, Baud, b1] command and not a [Serin RX, Baud, b1, b2] command to store the 2 bytes to be processed at one time ?
Also, is not the Serin command "blocking"?
That is, it would remain waiting for the bytes transmitted by serout (but which is only executed ONE time).
In my mind, the Serin command, placed at the beginning of the Main loop, as used here, will place the first byte in b1 but once this is done, the 2nd byte will be permanently lost and I do not see how the following Serin command , Placed lower in the conditional loop, will catch anything since there will be only ONE Serout transmitted and ALREADY read and that this Serout will have been sent only once and not renewed when This second Serin will arrive !?
Code:
main:
serin RX,baud,b1 ; wait for the next byte <------------First SERIN ------------------- 1 byte !?
; NB keep character mode test as first item in this list to optimise speed
if b1 < 253 then ; CHARACTERS
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
goto main ; quickly loop back to top
else if b1 = 254 then ; CONTROL <--------------------------------
low rs ; change to command mode for next character
serin RX,baud,b1 ; wait for the command byte <------- Second SERIN --------------------------???????????????
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
high rs ; back to character mode
goto main ; quickly loop back to top
else if b1 = 253 then ; MESSAGE(EEprom)
serin RX,baud,b1 ; wait for the next byte
gosub msg ; do the 16 character message
goto main ; back to top
else ; must be 255 ; OUTPUT
serin RX,baud,b1 ; wait for the next byte
let pinsC = b1 & %00000111 | %10000000
; output the data on C.0 to C.2, keep RS high
goto main ; back to top
end if
Last edited: