sending streams over serial port in win32
I need a commented sample code for a Win app to send a stream via the serial port. Unfortunately the C
is the only language I know. I have found some example codes on this forum, but I could'n understand
the whole codes because I know very little about WinApi. I have already made a window and some menus
using DevC++ and a skeleton code from SourceForge (changed properly). My app should send a file or a text
typed in the app window to a PIC microcontroller connected to the serial port over an MAX232 inverter.
It should run as follows:
1. Sends an "active(?)" RTS signal to the uC.
2. Polls the CTS signal from the uC until it turns "active(?)"(or uses an interrupt to do this ?).
3. Sends the data with params 57600 Kbps, 8bits, no parity, 1 Stop bit.
It should work on any win95 platform and above! Well, if not i would like the code to be as simple as possible
(as I know the NT based systems work differently with this kind of peripherals and accesing some drivers would be
necesarry) . My OS is Vista and if I run the app in WIN95 compatibility mode is it going to work ?
Also the CTS and RTS are used once per stream (not for every byte) - the uC is smart enough to know how much and how long
it will receive. It would be nice to know the Rs232 levels when these 2 signals are enabled (and to have the option to
change their logical level in the code), because I'm a little confused. I have 2 serial monitor programms and if I set
the RTS pin "ON" i get a positive RS232 level and 0 V TTL level at the uC and vice-versa (from the PiC to the PC). Shouldn't that be
I would also like to know how can I get the text typed in the app window and put it in a buffer (in order to send it).
Thanks in advance !