Microsoft Visual C# and Parallax
Tony Stark
Posts: 3
I'm a newbie to microchips. I'm playing with a PIC16F690 and PIC12F509(Microchip, Inc...not Parallax). I just learned that if I want to get away from assembly language and get into C programming language, I have to spend $150 for a C compiler. That was a big turn-off for me. I'm thinking of switching over to Parallax microchips just for that very reason. Anyway...
...I want to get into RS-232 communications. I wasn't able to do it with the PIC chip (demo compiler doesn't support my chip unless I spent $150). I'm looking at Parallax chips and I understand there are 3 families: BASIC, SX and Propeller. I don't get the impression that BASIC family chips support serial communication. Is this true? Should I start with an SX chip? I love it that I get a compiler with my purchase of the starter kit for the SX!
And now, the BIG QUESTION: in the end, I want to create a custom Windows interface that talks with a microchip via RS-232. Do any of you know if it's possible to get an SX microchip (programmed for serial comm.) to talk with a program created using Microsoft Visual C# 2008 Express Edition? Anybody done it before?
Don't get me wrong--displaying stuff on a 2x16 LCD is neat, but I'm a sucker for fancy graphics. I would do anything to display stuff on a custom interface on my PC instead! Let's talk about this...
-Tony Stark
...I want to get into RS-232 communications. I wasn't able to do it with the PIC chip (demo compiler doesn't support my chip unless I spent $150). I'm looking at Parallax chips and I understand there are 3 families: BASIC, SX and Propeller. I don't get the impression that BASIC family chips support serial communication. Is this true? Should I start with an SX chip? I love it that I get a compiler with my purchase of the starter kit for the SX!
And now, the BIG QUESTION: in the end, I want to create a custom Windows interface that talks with a microchip via RS-232. Do any of you know if it's possible to get an SX microchip (programmed for serial comm.) to talk with a program created using Microsoft Visual C# 2008 Express Edition? Anybody done it before?
Don't get me wrong--displaying stuff on a 2x16 LCD is neat, but I'm a sucker for fancy graphics. I would do anything to display stuff on a custom interface on my PC instead! Let's talk about this...
-Tony Stark
Comments
This is an old article but will show you how; of course, you'd want to update the code and create a protocol that suits your GUI
-- www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol6/col/nv125.pdf
I think the Express Edition allows serial control -- Jan Axelson wrote an article on VB.NET an serial control of microcontrollers last May (also in Nuts & Volts). I downloaded her program (from www.lvr.com) and connected it to an SX running a program I wrote to duplicate what she was doing with a PIC.
most of my commercial applications today are the combination of an SX-based hardware, and a PC with a GUI, "talking" to the SX unit via RS-232.
Usually, I write my SX code in assembly, and to create the PC GUI, I use VB 6.0. I'm not familiar with the Visual C# Express Edition, so I can't tell if it supports serial COM ports but I think it should.
On the SX side, a serial receiver/transmitter requires just a couple of code lines in assembly. When you use SX/B, it is just the SERIN/SEROUT commands.
Normally, I use some "home-brew" protocol for communications. For example, the PC sends a specific command character, eventually followed by a sequence of parameter bytes, and the SX unit sends back an acknowledge character, like an "O" for Ok, eventually followed by a sequence of parameter bytes. In critical applications I usually include checksums in the parameter sequences so that both units can detect communication errors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Guenther: Wow...did you say you have "commercial applications"? That's serious stuff! I'm doing this as a hobby, but my job can use a lot of help from PC's talking to a micro that is monitoring valves, motors, meters, etc. Ultimately, I want to create a presentable GUI on a PC with the micro sending info. (data acquisition) to it. In the end, my program might replace a few employees...I wish them well in their new jobs--he-he!
I am very pleased to hear that this is not only possible, but as you both say, very easily accomplished. I am on my way to getting started. Thanks.
-- www.efx-tek.com/php/smf/index.php?topic=994.0
I tried your code but I got three compile errors.
Line 234 Invalid number of Parameters
Line 239 Invalid number of Parameters
Line 405 Unknown command STR
Ryan