It is just a little Example that I am showing just to see how the rs232 works
it opens the Com no problem, the sends a FA; Sending that command to answer what Freq it is on
then "Result = AvailableSerialPortInput(1)" result always reads 0 ( I should get 14 ) to show nothing to get
If i run a rs232 Port Monitor i see:
" 46 41 30 30 30 35 30 31 34 30 31 38 30 3B FA00050140180;"
but if i start Hyper-Terminal and set the com the same way i get the answer back that was setting in the buffer?
" FA00050140180; "
I have played with this for 2 days and i cant see what i am doing wrong
Code: Select all
Define.l read_amount, incoming = AllocateMemory(1024)
If OpenSerialPort(1, "COM1", 9600, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_NoHandshake, 1024, 1024)
MessageRequester("Information", "SerialPort opened with success")
Else
MessageRequester("Error", "Can't open the serial port: "+Port$)
EndIf
Delay(1000)
WriteSerialPortString(1, "FA;")
Delay(1000)
Result = AvailableSerialPortInput(1)
Delay(1000)
Debug Result
Delay(1000)
For a = 1 To Result
read_amount = ReadSerialPortData(1, incoming, Length)
Delay(1000)
Debug PeekS(incoming, read_amount)
Next a
End