Hello,
I have written the following program in MS Visual C++ running on windows XP. It is supposed to set all the data lines of my parallel port to "high" when password 2006 is entered, and "low" when 9999 is entered. I am using UserPort to get around the port access restrictions of XP. I have a multimeter hooked up to pins 2 and 18 on my computer, and I'm reading 4.2 volts no matter what I enter. Here is the code:
Is this code simply flawed, or is there some other issue here?Code:#include "stdafx.h" #include "conio.h" #include "stdio.h" #include "string.h" #include "stdlib.h" #include <iostream> using namespace std; int main () { int i; do{ cout << "Please enter password: "; cin >> i; if (i == 2006) { cout << "\n Password accepted \n Unlocking door... \n"; _outp(0x378, 255); cout << " Door has been unlocked... \n \n \n"; } else if(i == 9999){ cout << " System shutting down... \n\n\n"; _outp(0x378, 0); } else { cout << "Entry denied \n\n"; } }while (i != 6606); return 0; }
Thanks,
James


Reply With Quote


Bookmarks