Home > Software engineering >  Consult the API driver serial port communication device, the use of readfile (), writefile (), progr
Consult the API driver serial port communication device, the use of readfile (), writefile (), progr

Time:10-09

Recently want to write a Win32 console application, mainly and a serial port communication equipment, you want to send commands to the device, and then received equipment returned data display on the console window, looking for some course, also know about the whole of the serial port driver, reading and writing process, is creatfile () configuration, DCB configuration, such as, but found the readfile () and writeflie () is in the main function call, and I want to have a serial port to read and write, has been constantly sending and receiving data, so I don't understand the data transfer is how to deal with, only know data from readfile () to my buff, so want to ask the next data from the equipment through a serial port communication to print to my console, what after? The buffer where it? Program is in the background of reading data from the interrupt way?

CodePudding user response:

Because I just turn around, from the aspects of embedded so familiar with commonly used microcontroller serial port interrupt way, speaking, reading and writing, and the concept of windos programming and application mechanism may not be very clear,,,, always feel that a serial port to read and write in the main function execution can realize real-time and background,,,,

CodePudding user response:

I want to realize the function,,, console procedures, instructions, and then input device after receiving instructions have been send the data to the host, the console interface, brush brush to flowing from these data.

CodePudding user response:

Not interrupt way,
Is driven by events,
Under the Windows program are driven by events,

Reading and writing process can not write in the main function,
It is ok to write inside the thread,
  • Related