RS232 help
Moderator: Benj
-
siliconchip
- Posts: 392
- Joined: Wed Jan 05, 2011 11:24 am
- Has thanked: 101 times
- Been thanked: 25 times
RS232 help
hi all can anyone help me with a simple program between a pic and pc using RS232 i have very basic knowledge on serial comms and would appreciate some help also can the 232 be used in changing the parameters of a program for example if i have a simple program flashing a LED at 1Hz can i change this frequency to say 3Hz via 232 with the program running, any help would be greatly appreciated thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 help
Hello,
Have you looked at the Flowcode 4 examples download. In there are example files for each of the components including RS232 to help get you started. The component help file (component properties -> help) is also a good reference point.
Also yes controlling things via the RS232 connection is simple to do. All you would do is say setup a timer interrupt based on a control variable to control your output. You would then listen for incoming messages and create your own protocol.
For example a simple 2 byte protocol like this could be used. command, data.
Here you would receive a byte and see if it is a valid command using decision icons or a switch icon. If a valid command is received then receive another byte and use this as the data for the specific task.
eg. command 0 = change frequency
command = RS232 receive byte
if command = 0
yes:
data = RS232 receive byte
new frequency = data
Have you looked at the Flowcode 4 examples download. In there are example files for each of the components including RS232 to help get you started. The component help file (component properties -> help) is also a good reference point.
Also yes controlling things via the RS232 connection is simple to do. All you would do is say setup a timer interrupt based on a control variable to control your output. You would then listen for incoming messages and create your own protocol.
For example a simple 2 byte protocol like this could be used. command, data.
Here you would receive a byte and see if it is a valid command using decision icons or a switch icon. If a valid command is received then receive another byte and use this as the data for the specific task.
eg. command 0 = change frequency
command = RS232 receive byte
if command = 0
yes:
data = RS232 receive byte
new frequency = data
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
siliconchip
- Posts: 392
- Joined: Wed Jan 05, 2011 11:24 am
- Has thanked: 101 times
- Been thanked: 25 times
Re: RS232 help
hi benj thanks for the reply but i am still unsure how my pc would interact using 232 do i need a program to open on the pc to get a screen up to communicate with the pic etc
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 help
Hello,
If your using XP then you can use Hyperterminal to manually send data to the PIC. On Win Vista or 7 download an application called RealTerm and this will do the same job.
To automate the process you could use the free version of VB 2010 as there are some good tutorials on how to get started with this.
This is a good starting point for the VB.
http://tiktakx.wordpress.com/2010/11/21 ... -net-2010/
If your using XP then you can use Hyperterminal to manually send data to the PIC. On Win Vista or 7 download an application called RealTerm and this will do the same job.
To automate the process you could use the free version of VB 2010 as there are some good tutorials on how to get started with this.
This is a good starting point for the VB.
http://tiktakx.wordpress.com/2010/11/21 ... -net-2010/
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel