Re: DTR _outp( 0x3F8 + 4, 1 )

From: Kurtis Martin (kurtis_at_ncat.edu)
Date: 10/12/03


Date: Sun, 12 Oct 2003 19:59:00 GMT

Got an answer. I don't have to use anything special to gain direct access
to the port, so giveio is not needed. I must use the correct functions.
Here is how to turn DTR line on for 10 seconds:

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>
#include <windows.h>

int main( int argc, char **argv )
{
 HANDLE h;

 h = CreateFile("\\\\.\\COM1",GENERIC_WRITE,0,NULL,OPEN_EXISTING,
          FILE_ATTRIBUTE_NORMAL,NULL);

 EscapeCommFunction(h,SETDTR);
 //_outp(0x02F8 + 4,1); Replaced by EscapeCommFunction.

 Sleep(10000); // allow DTR to be set for 10 seconds.

 CloseHandle(h);

 return 0;
}

"kdog" <kurtis@ncat.edu> wrote in message
news:0yIhb.44493$5r1.5636@twister.southeast.rr.com...
> Environment:
> - WinXP
> - VisualC++ .net
> - 2 wires hooked up to serial port between DTR and ground
> - giveio
>
> Problem:
>
> Trying to write a C/C++ program to change the state of the DTR line on
> COM 1. I thought the only thing I had to do was:
>
> _outp( 0x3F8 + 4, 1)
>
> I've already got pass the user mode permission exception using giveio.sys.
> I'm certain my application can directly access the ports, because I'm able
> to run the sample that came with giveio which writes to low-level memory
> addresses to play a song on the computers internal speaker. I'm trying to
> toggle
> the voltage between DTR and ground from +12V to -12V. I thought this is
> done by _outp( 0x3F8 + 4, 1) and _outp( 0x3F8 + 4, 0 ). That simple.
> Unfortunately, it doesn't work. The voltage stays at +12V.
> Of course If checked to make sure 3F8 is the address of COM1. Do I have
to
> initialize the port? What am I missing?
>
>
>



Relevant Pages

  • Re: SPI to RS232 Conversion
    ... write a kernel-mode device driver. ... If you need direct port access, DOSEmu on Linux is probably the best ... Direct access to ports below 0x400 can be enabled via the CPU's ...
    (sci.electronics.design)
  • Why to up/not grade to/from W98 (was: new Pulsonix version 3 PCB software released)
    ... > direct access to the serial chip. ... > port is blocked. ... and reading BOT/EOT markers and the raw MFM. ... calibration against CPU clock speed and unfettered raw access to ...
    (comp.arch.embedded)
  • Re: WinVista as Host for C64?
    ... allow for direct access to the printer port which X-cables tend to use. ... The main thing is not emulating. ... So the main thing is the software has to support the interface cable/device ...
    (comp.sys.cbm)
  • Re: DAC software
    ... Win95/98/ME allows the direct access to ports with the interrupts disabled. ... There are the special drivers for the port hacking in WinNT/2k/XP. ... solution using the dos found on the windows boot disk. ...
    (sci.electronics.design)
  • DTR _outp( 0x3F8 + 4, 1 )
    ... - 2 wires hooked up to serial port between DTR and ground ... to run the sample that came with giveio which writes to low-level memory ... the voltage between DTR and ground from +12V to -12V. ... The voltage stays at +12V. ...
    (comp.programming)