Hi all,
i'm new to FB, i need to create an application that send command to pic16f877 (micro).
ex; Pc send "ADCxxx" where "xxx" is delimiter, pc wait (with timeout) the reponse from micro. Micro send binary value 16bit (first byte have six 0 msb and 2 lsb, second byte all 8 bit..... is 10bit ADC).
i try with autoit (i'm not newbie but serial communication is hard for me in script language)...
In short, Pc send command (ADCxxx ONxxx OFFxxx) and micro always send response (OK or value "16 bit"). I need also to display value in a label or textbox and have button to start cycle.
Anyone can help me ?
Can you suggest a GUI tool ?
thanks
rs232 communication with microcontroller
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: rs232 communication with microcontroller
Hello stacker and welcome to the forum!
The serial port is accessed by OPEN COM.
If the µC provides a regular dataflow, you can communicate with it via the PRINT # and INPUT # statements.
The serial port is accessed by OPEN COM.
If the µC provides a regular dataflow, you can communicate with it via the PRINT # and INPUT # statements.
Last edited by grindstone on Jul 15, 2018 22:45, edited 1 time in total.
Re: rs232 communication with microcontroller
Hi grindstone can you explain with example?
uC dataflow is only when pc send command... pc wait for return message from uC.
Thanks
uC dataflow is only when pc send command... pc wait for return message from uC.
Thanks
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: rs232 communication with microcontroller
In a trice: This snippet tests the port if connected to a loopback plug:
If everything's OK, your keystrokes should be printed on the screen.
Code: Select all
ScreenRes 300,300,32
'Open Com "com4: 9600, N, 8, 1,cs0,ds0,cd0,rs" As #1
Open "c:\test.txt" For Binary As #1
Dim As String Puffer, Taste
Do
Taste = InKey
If (Taste <> "") Then
Put #1, , Taste
End If
If Loc(1) > 0 Then
Puffer = Space(Loc(1))
Get #1, 1, Puffer
Seek 1,1 'simulated reading of the receive buffer
Print Puffer;
End If
Sleep 100
Loop Until Taste = Chr(27)
Close #1
Kill("c:\test.txt")
Re: rs232 communication with microcontroller
Thanks i will try today.
But i think i need more help with fb :( :(
But i think i need more help with fb :( :(
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: rs232 communication with microcontroller
You're always welcome :-)stacker wrote:But i think i need more help with fb :( :(
Re: rs232 communication with microcontroller
Hi, for now i find solution in Autoit. I think to "convert" in fb in the future.
Thanks for support
Thanks for support