Making a programm to communicate with a mikrokontroller in visual C++ any tips?

Started by
13 comments, last by CProgrammer 20 years, 1 month ago
That sounds a bit overkill (but then again, maybe it''ll make things easier; I don''t know anything about ActiveX). Have a look here for some more information on I/O using Win32.

sam
Advertisement
Oh that link was very interesting.
Thanks a bunch.
-CProgrammer
If you want just vanilla com port access, write code for the AVR so it understands RS232 (unless it already does? I've usually used Parallax SX-series chips, which don't). Then use Win32 CreateFile()/ReadFile()/WriteFile() using "COMX" as the filename. [edit: "COMX" where X is 1, 2, 3, 4. Of course.]

If you wanna get swanky, FTDI have a neat chip called the FT245BM, which is basically a USB interface on a chip - it talks to your micro through an 8-bit FIFO. Dead simple to use - if you get one of the premade modules, you can get it going in an hour or two.

*waves at aboeing*

[edited by - fractoid on February 25, 2004 6:53:38 AM]
As a former EE Major, I''ve done some microcontroller work. I assume that you''re familiar with parallel/serial communications, cause you''re gonna have to pick one.

I specialize in the Microchip Corp "PIC" controller. Some models have an internal UART, which is handy. Still others have usb interfaces. In either case, memory is precious, so be careful on your implementation.

Using Visual C++, I assume you''re using the serial/parallel ports for I/O. Tricky. Windows is a protected universe, one that doesn''t take kindly to direct hardware access. I''m sure the MSDN library has something about opening up serial ports, at least. With work, you may be able to open up COM1/2/3, using high-level functions. In XP, this is your only choice. In earlier versions of windows, you can write a DOS app, and control it (the COM port) directly.

Goodluck.
"This I Command" - Serpentor, Ruler of C.O.B.R.A
As zarthrag says, you can''t read/write data to the serial port directly using the _inp() and _outp() functions under Windows XP without first unlocking them with something like WinIo.

You can still write to them using standard RS232, through the file IO functions, as I said earlier. I believe it is much better to do it this way than the direct bit-twiddling approach. (WinIo might go away with the next version of Windows, and also if you do it the politically correct way then your code will work over a USB-to-serial converter cable, which is important if you want to run off a laptop.

This topic is closed to new replies.

Advertisement