Is there an example I can look at to understand how to implement RS-232 communications between a PC and PIC in Fowcode?
I want to use a Modtronix board with an RS-232 connector to communicate with a PC. The PIC is a 16F876A. The board can be seen here:
http://www.modtronix.com/product_info.p ... cts_id=110
Using Hyperterminal I want to send a Character to the PIC. When the PIC receives the Character, it responds with another Character.
Any information / guidance on this would be helpful.
RS-232 Flowcode Example?
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
- Contact:
Hi,
I do not know your board, but since you are using Flowcode and Hyperterminal then you should have a reliable starting point.
I suggest
1) set up a loop in Flowcode continously sending an ASCII character every 100ms.
2) Open hyperterminal with the correct board rate, parity etc.
Watch for input. It should work. If not then change things, check things, until it does. Once you see the input everything after that is simply a matter of refinement.
Do'nt forget to only send ASCII character codes, otherwise hyperterminal will not let you 'see' them e.g. send values of 48 to 58 for 0 to 9, sending 0 to 9 as such is invisible as these are control characters.
For recieve, do pretty much the same, set up a loop to display any other character other than 255. Type in hyperterminal and see the response, no response then check and check again.
I suggest you disable hardware handhaking in Flowcode AND Hyperterminal to sart with.
After you have the above working the rest is simply up to you to do the work of embelishing the programme to suit you = read the mauals etc.
m.v.g. / good luck
Mark
I do not know your board, but since you are using Flowcode and Hyperterminal then you should have a reliable starting point.
I suggest
1) set up a loop in Flowcode continously sending an ASCII character every 100ms.
2) Open hyperterminal with the correct board rate, parity etc.
Watch for input. It should work. If not then change things, check things, until it does. Once you see the input everything after that is simply a matter of refinement.
Do'nt forget to only send ASCII character codes, otherwise hyperterminal will not let you 'see' them e.g. send values of 48 to 58 for 0 to 9, sending 0 to 9 as such is invisible as these are control characters.
For recieve, do pretty much the same, set up a loop to display any other character other than 255. Type in hyperterminal and see the response, no response then check and check again.
I suggest you disable hardware handhaking in Flowcode AND Hyperterminal to sart with.
After you have the above working the rest is simply up to you to do the work of embelishing the programme to suit you = read the mauals etc.
m.v.g. / good luck
Mark
Go with the Flow.
- 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:
Yes what Mark has said is a good starting point.
To transmit ascii characters you can use 'A'
or to transmit a string you can use "Hello"
To transmit ascii characters you can use 'A'
or to transmit a string you can use "Hello"
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
-
- Flowcode v5 User
- Posts: 71
- Joined: Fri Nov 03, 2006 2:28 pm
- Location: RSA
- Been thanked: 1 time
- Contact:
Hi,
If you look in this forum for a heading "RS232 Parity Bits" you will find a lot of helpfull info form Steve and Benj regarding RS232 Comm's.
I find Hyperterminal not very helpfull. I use Serial Port Monitor From Eltima it's a very good tool to debug Comm's.
http://www.eltima.com/purchase/serial-port-monitor/
I'm a novice to Flowcode and programing as well but since I bought Flowcode3 and with the help of Matrix technical support engineers I've grown so much in programing Pic's that I wouldn't even dream doing in a conventional way in such a short time.
Pinto
If you look in this forum for a heading "RS232 Parity Bits" you will find a lot of helpfull info form Steve and Benj regarding RS232 Comm's.
I find Hyperterminal not very helpfull. I use Serial Port Monitor From Eltima it's a very good tool to debug Comm's.
http://www.eltima.com/purchase/serial-port-monitor/
I'm a novice to Flowcode and programing as well but since I bought Flowcode3 and with the help of Matrix technical support engineers I've grown so much in programing Pic's that I wouldn't even dream doing in a conventional way in such a short time.
Pinto
Some success
I haven't been able to compile usable code to the F88, but I was able to with an F876A.
In the end I used hyperterminal to send an ASCII to the PIC and then displayed it on a 4x20 LCD. I've started playing around with VB2005 and in 5 minutes wrote a small program to send the contents of a user textbox to the PIC for display on the LCD. It seems a bit slow and it only sends 3 characters at a time for some reason. Anyone familiar with VB2005 and why that might be?
But for what it is worth, I am happy with the outcome and a serial LCD will be very useful. Now I just need to learn a bit about sending commands to the LCD and learn what controls that provides.
In the end I used hyperterminal to send an ASCII to the PIC and then displayed it on a 4x20 LCD. I've started playing around with VB2005 and in 5 minutes wrote a small program to send the contents of a user textbox to the PIC for display on the LCD. It seems a bit slow and it only sends 3 characters at a time for some reason. Anyone familiar with VB2005 and why that might be?
But for what it is worth, I am happy with the outcome and a serial LCD will be very useful. Now I just need to learn a bit about sending commands to the LCD and learn what controls that provides.
rvogel
- Steve
- Matrix Staff
- Posts: 3418
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
There is an article about RS232 comms using Flowcode and VB in our learning centre. Go here:
http://www.matrixmultimedia.com/Learnin ... /index.php
and look for the "Using Visual Basic with E-blocks" article.
http://www.matrixmultimedia.com/Learnin ... /index.php
and look for the "Using Visual Basic with E-blocks" article.