Toggling the DTR line with an RS232 COM port from ATEasy

Knowledge Base Article # Q200033

Read Prior Article Read Next Article
Summary The DTR line is connected to Modem Control Register (MCR) bit 0 at an offset of 4. Setting this bit to 1 makes the line active.
  
Login to rate article
Solution:

Before starting, you must know the base address for the port, which can be obtained from Windows Device Manager Resource tab. Usually the base address for COM1 is 0x3F8.

The DTR line is connected to Modem Control Register (MCR) bit 0 at an offset of 4 (e.g., 0x3F8 + 4). Setting this bit to 1 makes the line active.

For example:

iBase=0x3F8
ucByte=PortInByte(iBase+4)

! set DTR On
PortOutByte(iBase+4, ucByte or 0x1)
Delay(500)

! set DTR Off
PortOutByte(iBase+4, ucByte and 0xFE)

Article Date 9/25/2002
Keywords ATEasy, COMM, RS-232, DTR


Login to rate article

Read Prior Article Read Next Article
>