EmbeddedRelated.com
Forums

RS232 between PC and embedded MPU

Started by js1180 February 24, 2005
What is the best method to have a PC and embedded MPU communicate with 
RS232? I have a HC08 that doesn't have SCI, so it would all have to be in 
software. There are probably ROM routines that would help but I haven't been 
able to find any documentation on them. This seems like it should be a "cut 
and paste" job. Maybe I have to code it myself.

On the PC side I was thinking of using Visual Basic, thinking that would be 
the easiest.

I already have the IDE up and running - so I don't need it for debug, or 
programming. I am trying to get a stand-alone data collection project 
running with an embedded MPU and a PC. The PC would receive the data, save, 
and graph it.

Does anyone have any experience in this? Thanks. 


I don't know much about software UARTs. You could try a hardware UART
on the SPI bus.  The external UART will require an appropriate crystal
to generate the clock signal.

-- Arya

"js1180" <spastula@comcast.net> wrote in message 
news:1109300064.3eb2a697a9fb1b7f91365bd8e7afa5e4@teranews...
> What is the best method to have a PC and embedded MPU communicate with > RS232? I have a HC08 that doesn't have SCI, so it would all have to be in > software. There are probably ROM routines that would help but I haven't > been able to find any documentation on them. This seems like it should be > a "cut and paste" job. Maybe I have to code it myself. > > On the PC side I was thinking of using Visual Basic, thinking that would > be the easiest. > > I already have the IDE up and running - so I don't need it for debug, or > programming. I am trying to get a stand-alone data collection project > running with an embedded MPU and a PC. The PC would receive the data, > save, and graph it. > > Does anyone have any experience in this? Thanks. >
I have absolutely no experience in the HC08 but plenty in Google. This link seems to cover what you want. http://www.hc08.cz/attachments/uart.pdf Peter
js1180 <spastula@comcast.net> wrote:
> On the PC side I was thinking of using Visual Basic, thinking that would be > the easiest. >
Java is pretty easy, just download the javas.comm package from sun. Its a sinch to use java and RS232 interface. -- Wing Wong. Webpage: http://wing.ucc.asn.au
js1180 wrote:
> What is the best method to have a PC and embedded MPU communicate
with
> RS232? I have a HC08 that doesn't have SCI, so it would all have to
be in
> software. There are probably ROM routines that would help but I
haven't been
> able to find any documentation on them. This seems like it should be
a "cut
> and paste" job. Maybe I have to code it myself. > > On the PC side I was thinking of using Visual Basic, thinking that
would be
> the easiest. > > I already have the IDE up and running - so I don't need it for debug,
or
> programming. I am trying to get a stand-alone data collection project
> running with an embedded MPU and a PC. The PC would receive the data,
save,
> and graph it. > > Does anyone have any experience in this? Thanks.
Have you looked at HyperTerminal? It's already on the PC and has proven adaptable for creating data files of the sort you seem to be describing for many of the simple test beds I've set up. Regards, Ken Asbury
"js1180" <spastula@comcast.net> wrote:

>What is the best method to have a PC and embedded MPU communicate with >RS232? I have a HC08 that doesn't have SCI, so it would all have to be in
there are some appnotes describing different approaches, e.g. using a hardware timer (interrupt). [...]
>On the PC side I was thinking of using Visual Basic, thinking that would be >the easiest.
VB doesn't support the serial interface nicely, but you can use rsapi from Berndt and Kainka. If you want to do it in "plain C" and Win32, there will be soon a simple but powerful open source solution ("serialapi") in sf.net. Contact Andi Martin or me if you need it earlier. Oliver -- Oliver Betz, Muenchen (oliverbetz.de)
On 2005-02-25, Oliver Betz <OBetz@despammed.com> wrote:

>>On the PC side I was thinking of using Visual Basic, thinking >>that would be the easiest. > > VB doesn't support the serial interface nicely, but you can use rsapi > from Berndt and Kainka.
Using a serial port in Python is dead simple using the pyserial module. If you want to get fancy, it's not all that hard to use the native Win32 File API so you can do async stuff. -- Grant Edwards grante Yow! I'm rated PG-34!! at visi.com
> On the PC side I was thinking of using Visual Basic, thinking that would be > the easiest.
If this is roll-your-own then the easiest is to drop windows and run under DOS -- boot dos, not the dos-box in windows, though the dos-box did work on Windows 95. Next is non-visual C and a communications library. I have never tried doing data logging / instrument control with Visual-xx or NET, so maybe that is, after all is said and done, the best choice. -- Nicholas O. Lindan, Cleveland, Ohio Consulting Engineer: Electronics; Informatics; Photonics. To reply, remove spaces: n o lindan at ix . netcom . com psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
"Nicholas O. Lindan" <see@sig.com> wrote in message
news:ZcQTd.15194$x53.14410@newsread3.news.atl.earthlink.net...
> > On the PC side I was thinking of using Visual Basic, thinking that would
be
> > the easiest. > > If this is roll-your-own then the easiest is to drop windows and run under
DOS
> -- boot dos, not the dos-box in windows, though the dos-box did work on
Windows
> 95. > > Next is non-visual C and a communications library. > > I have never tried doing data logging / instrument control with Visual-xx
or
> NET, > so maybe that is, after all is said and done, the best choice. > > -- > Nicholas O. Lindan, Cleveland, Ohio > Consulting Engineer: Electronics; Informatics; Photonics. > To reply, remove spaces: n o lindan at ix . netcom . com > psst.. want to buy an f-stop timer? nolindan.com/da/fstop/ >
Heck, you can run just fine in a DOS box under Win95, Win98, and Win2k. I've done it without problems on all of these. Use an interrupt handler under Win9x, and just poll under Win2k. Win2k handles the I/O to the port, and supplies buffering, so you don't need to do it for that OS. If you want to, you can sort of detect the OS running from DOS, by using some Win9x int calls. Alas, Win2k detects as if Windows is not running, but once you know that it's not a problem. Hope this helps, Mike Anton
On the PC side, if you want VB or VBA/Excel code, drop me a line. I
have two examples that I can send you. One is VB6, the other is Excel
with VBA. Both  use the MSComm control.  I've used both of these for
what you are interested in doing.  

Sorry can't help you with the HC08, but code should be available
searching google. I've done bit-banging on the PIC.  Select a UART to
handle the voltage adjustments.  Make sure you put a jmp on the board
so you can loopback the UART. This makes it easy to test using an
"echo" type test with the jumper in place across RX/TX.  If you are
using "C", implement it in "C", then extract the assembler and hand
code it to get the timing right.

g9u5dd43@yahoo.com
Indianapolis, IN USA

On Thu, 24 Feb 2005 21:54:23 -0500, "js1180" <spastula@comcast.net>
wrote:
>What is the best method to have a PC and embedded MPU communicate with >RS232? I have a HC08 that doesn't have SCI, so it would all have to be in >software. There are probably ROM routines that would help but I haven't been >able to find any documentation on them. This seems like it should be a "cut >and paste" job. Maybe I have to code it myself. >On the PC side I was thinking of using Visual Basic, thinking that would be >the easiest. >I already have the IDE up and running - so I don't need it for debug, or >programming. I am trying to get a stand-alone data collection project >running with an embedded MPU and a PC. The PC would receive the > data, save, and graph it. >Does anyone have any experience in this? Thanks.