Page 1 of 1
RS-232 Flowcode Example?
Posted: Thu Mar 08, 2007 8:21 pm
by rvogel
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.
Posted: Thu Mar 08, 2007 10:51 pm
by Mark
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
Posted: Fri Mar 09, 2007 12:21 pm
by Benj
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"
Posted: Sat Mar 10, 2007 10:38 am
by PINTO
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
Some success
Posted: Tue Mar 13, 2007 11:24 pm
by rvogel
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.
Posted: Wed Mar 14, 2007 11:32 am
by Steve
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.