Finally I could connect to COM1 running the COMM CHECKING:
ON ERROR GOTO Handler
FF = FREEFILE
comPort$ = "COM1:" 'try a COM port number that does not exist
CONST comMode$ = "9600,N,8,1,CS0,DS0" 'Use 0 to avoid timeouts
OPEN comPort$ + comMode$ FOR RANDOM AS FF
IF errnum = 0 THEN PRINT "COM exists!
K$ = INPUT$(1)
END
Handler:
errnum = ERR
PRINT "Error:"; errnum
RESUME NEXT
It does not works with other COM ports like COM14 , COM15.... I believe works only with lower numbers....
But I am far away to understand how get my sensor data into a INT variable
The sensor data is serial 9600 8N1 stream with sentences like:
"1955mm" (ASCII without the quotes, followed by LF + CR)
I need to get only the numbers in a variable
I know that i need use the GET command but i do not understand what syntax use..... and also about synchronizing the data. May be waiting the LF+CR characters ...then GET the four characters...
When trying to send data to port with:
i=mynumber%
a$ = STR$(i) 'number to string
PUT #1, , a$ 'send string to serial port
the received characters are added with STX (start of text) and EOT (end of transmission).... (ASCII 02 and 04)
Any help will be very appreciated