io - Using inp() on 16Bit Dos 5with Turbo C++ 3.0 -
first off i'd know outdated question. that,s why can't find information through google. (or i'm worse @ searching i'd admit! haha.) results pretty tell me inp()
& outp()
useless on modern systems because kernel handles input , output rather program. i'm running 16 bit dos 486 machine , i've been able use outp()
parallel port perfectly. 16 bit dos, , i'm not interested in learning "new , improved" way of doing on nt era systems , higher (at least not right now).
with cleared --
my question in regards inp()
. have old hardcopy manual says pass single variable, port address, inp()
. in case assume since use 0x378
port outp()
, i'd use inp()
well. since haven't programmed accept external input before, wasn't sure type of value i'd simple on/off switch wrote quick code grab new values-
#include <iostream.h> #include <stdio.h> #include <conio.h> #include <time.h> #include <dos.h> int main(void){ clrscr(); int input; int buff = 0; restart: input = inp(0x378); if(input != buff){ cout<<input; buff = input; } goto restart; }
i used 'buff' wouldn't keep spitting '255' out on , on , possibly cover different value when power applied input pin. needless say, value got printed '255'.
when write program output data "d" pins on parallel port, send hex code port corresponds desired output... right dealing "s" pins on parallel port input. should getting hex code program?
also, went bios , made sure mode parallel port in/out, not out. after finding out had 2 modes, wave of excitement got crushed same lousy '255' output.
any information point me in right direction helpful.
thanks!
this looks thorough: http://www.beyondlogic.org/spp/parallel.htm
also, make sure configure parallel port in bios bidirectional mode. other possibilities output only, epp , ecp modes, bidirectional work best trying do. you'll need bit 5 in 0x37a control direction of port. also, base address of port using might not 0x378...there locations in memory base addresses of lpt1-lpt4 (the bios setup page may tell well.)
Comments
Post a Comment