Click here to Skip to main content
15,880,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralParallel Port Question Pin
zahid_ash9-Aug-04 19:44
zahid_ash9-Aug-04 19:44 
GeneralRe: Parallel Port Question Pin
Antti Keskinen9-Aug-04 21:22
Antti Keskinen9-Aug-04 21:22 
GeneralRe: Parallel Port Question Pin
zahid_ash9-Aug-04 21:33
zahid_ash9-Aug-04 21:33 
GeneralRe: Parallel Port Question Pin
Antti Keskinen10-Aug-04 0:08
Antti Keskinen10-Aug-04 0:08 
GeneralRe: Parallel Port Question Pin
zahid_ash10-Aug-04 0:38
zahid_ash10-Aug-04 0:38 
GeneralRe: Parallel Port Question Pin
Antti Keskinen10-Aug-04 1:23
Antti Keskinen10-Aug-04 1:23 
GeneralRe: Parallel Port Question Pin
zahid_ash10-Aug-04 1:59
zahid_ash10-Aug-04 1:59 
GeneralRe: Parallel Port Question Pin
Antti Keskinen10-Aug-04 2:41
Antti Keskinen10-Aug-04 2:41 
This happens because both your application and the device are writing to the port at the same time.

The Inpout32 library, when you call Out32(), will set the port's pins to represent the value you specify. This means that the pins will stay powered even after the call is completed.

To initiate succesfull communication with your device through the same port, first use Out32(888, 0) to clear any previous outputs. Then write Out32(888, 18). Now make your device read the value in some way (press a button, for example). When done, write Out32(888, 0) again. Put your device to send data, and use Inp32 to read the value.

The problem itself is simple: both you and the device are issuing voltage to the port's pins. This means that if you write 00000001 and your device answers to this by putting 10000000, the port will end up with 10000001, unless you clear your own output first. So, the trick is to call Out32(888, 0) before reading the input.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Parallel Port Question Pin
zahid_ash10-Aug-04 2:15
zahid_ash10-Aug-04 2:15 
GeneralRe: Parallel Port Question Pin
kandyelectrical12-Dec-12 22:50
kandyelectrical12-Dec-12 22:50 
QuestionHow to know security context ? Pin
Amarelia9-Aug-04 19:16
Amarelia9-Aug-04 19:16 
GeneralcreateEventObject fails Pin
yourbuddy779-Aug-04 19:05
yourbuddy779-Aug-04 19:05 
GeneralSTATIC Text Color Problem Pin
Anonymous9-Aug-04 19:03
Anonymous9-Aug-04 19:03 
GeneralRe: STATIC Text Color Problem Pin
Johan Rosengren10-Aug-04 0:42
Johan Rosengren10-Aug-04 0:42 
GeneralRe: STATIC Text Color Problem Pin
Johan Rosengren10-Aug-04 1:23
Johan Rosengren10-Aug-04 1:23 
GeneralVisual C++ Standard Edition Pin
zecodela9-Aug-04 16:22
zecodela9-Aug-04 16:22 
GeneralRe: Visual C++ Standard Edition Pin
Antti Keskinen9-Aug-04 20:47
Antti Keskinen9-Aug-04 20:47 
GeneralC++ global const question Pin
Indrawati9-Aug-04 15:34
Indrawati9-Aug-04 15:34 
GeneralRe: C++ global const question Pin
Jeff Bogan9-Aug-04 17:27
Jeff Bogan9-Aug-04 17:27 
GeneralRe: C++ global const question Pin
Anonymous9-Aug-04 18:40
Anonymous9-Aug-04 18:40 
GeneralRe: C++ global const question Pin
Tim Smith10-Aug-04 3:52
Tim Smith10-Aug-04 3:52 
GeneralRe: C++ global const question Pin
Nitron10-Aug-04 5:47
Nitron10-Aug-04 5:47 
GeneralRe: C++ global const question Pin
Jeff Bogan10-Aug-04 5:10
Jeff Bogan10-Aug-04 5:10 
GeneralRe: C++ global const question Pin
Ryan Binns9-Aug-04 18:24
Ryan Binns9-Aug-04 18:24 
GeneralCreateThread is not Calling the function in DLL Pin
aman20069-Aug-04 14:27
aman20069-Aug-04 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.