Action
Retrieves a byte from the software UART.
Syntax
GET #channel , var
Remarks
Channel |
Positive numeric constant that refers to the opened channel. |
Var |
A variable that receives the value from the software UART. |
Note that the channel must be opened with the OPEN statement.
Also, note that the CLOSE statement, must be the last in your program. Please see comment on OPEN statement
An optional TIMEOUT can be specified so that the routine will return when no character is received.
See also
Example
Dim S As String * 12 , I As Byte , A As Byte , Dum As Byte
Open "com3.1:9600" For Output As #1 'p3.1 is normally used for tx so testing is easy
Open "com3.0:9600" For Input As #2 'p3.0 is normally used for RX so testing is easy
S = "test this" 'assign string
Dum = Len(s) 'get length of string
For I = 1 To Dum 'for all characters from left to right
A = Mid(s , I , 1) 'get character
Put #1 , A 'write it to comport
Next
Do
Get #2 , A 'get character from comport
Put #1 , A 'write it back
Print A 'use normal channel
Loop
Printbin #1, a 'Printbin is also supported
Inputbin #2, a 'Inputbin is also supported
Close #1 ' finally close device
Close #2
End
'To use the TIMEOUT option include (without the remarks):
'$TIMEOUT
' Get #2 , A TIMEOUT = 10000 'get character from comport