Look RS232 > RS232C Hardware  
fCoder SIA
fCoder SIA Look RS232 Download Order Support Cookie Policy
Look RS232
Online help
Modem Programming
Serial port
RS232 Hardware
  About programming

Unlike DOS, Windows 9x,NT,2000,XP work with hardware in a different way. While a DOS driver could be created with asm and have direct acsess to ports, it is a bit more complicated in Windows.It is connected with the fact that Windows, unlike DOS, is a multitasking system which makes it impossible to allow every application to directly change the hardware settings, as one application may fail to 'know' about the changes made to the hardware settings by some other application. Actually one can use asm in and out 378h functions under Windows 9x, but it is undesirable due to said above. To create programmes working with hardware under Windows one should use API (application programming interface). This interface allows to use Windows system services from application programmes. API realization is at that entrusted to the drivers. Windows Driver Developer Kit (DDK)is used to create drivers (there is a separate DDK for every Windows OS). Besides API one can use IOCTL codes (this method was widely used in DOS),but we shall deal with API functions only.

Work with hardware under Windows.

API standartizes work with hardware. To get access to hardware the following steps are used:

  • Get Handler of the device by calling CreateFile with the device name. For more information refer to. Windows SDK Help.
  • To control the device, call an API fuction for this device or send IOCTL(input - output control), the latter via DeviceIOCtl (for more information refer to Windows SDK Help).

In Windows all input/output ports are presented as files, so work with ports is mainly carried out via i/o functions of the file (CreateFile, CloseHandle, ReadFile, ReadFileEx, WriteFile and WriteFileEx). These functions organize the main interface for opening and closing the connection resource descriptor and carrying out read/write operations. API also includes a set of connection functions which provide access to connection resourses.

The usage of the I/O file and connection functions allows the application to perform the following tasks:

  • Getting the serial port descriptor.
  • Serial port configuration set and request.
  • Reading from or writing into the serial port.
  • Control of the given events set, which could occur for this serial port.

  • Sending the executive instructions to the driver of the device connected with the specified serial port; driver call-in is required for extended functions execution.

  Contact us
© fCoder SIA