HCS12 serial mysql database queries

Started by es_styx66 February 26, 2007
I need my hcs12 to have access to a mysql database. I assume i need a
c/c++ app running on the mysql PC to receive the queries via serial
communication and execute them, then return the results (if any) to
the hcs12 for processing.

I just don't know where to start. Anyone have any example c/c++
programs for communicating serially with the hcs12? The mysql part I
think I can handle.

Thanks in advance!

-Ben
--- In 6..., "es_styx66" wrote:
>
> I need my hcs12 to have access to a mysql database. I assume i need a
> c/c++ app running on the mysql PC to receive the queries via serial
> communication and execute them, then return the results (if any) to
> the hcs12 for processing.

Any PC language that can support serial and mysql (perhaps thru ODBC)
should be fine. That includes C, VB6, VB.NET, C#, Delphi, and
scripting languages like Python and Perl. And probably dozens of others.

> I just don't know where to start. Anyone have any example c/c++
> programs for communicating serially with the hcs12? The mysql part I
> think I can handle.

I use Delphi and C# to talk to these devices, but I also have VB.NET
code. The trick here is that any serial code for the PC can talk to
these babies, so it doesn't matter what kind of demo code you get.

In Win32 you can't access the serial port directly, so most of us use
objects that can do it for us. If you want to use the WinAPI directly
you can open the port with CreateFile. I don't recommend wrestling
with the Win32 API unless you have some experience with it.

For C and VB6 you can use the MSCOMM.ocx object.

Maybe VC++ comes with an appropriate class for this purpose. Maybe as
part of ATL or MFC?

Here's some VC++ code (anything that works in Windows 2000 should work
in XP):
http://www.codeproject.com/system/cserialcom.asp
http://www.codeproject.com/system/SerialPortComm.asp

Eric