Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

parallel port help!!

Status
Not open for further replies.

romaihi

New Member
hello everybody

im having a problem using the ECP parallel, im using VB6 to read from the parallel port from the data lines ( i need 8 bit input ) the bit 5 in the control lines is set to logic 1 even though still getting 0 from the data lines
 

demestav

Member
hello there. I am also working with the PP at the time. If you set the direction (bit 5) of the control register (address 0x37A) you should have no problem reading from the PP. Are you sure the drivers you are using, to operate the PP are OK?

On thing you could do is to check whether you VB program is setting the bit 5 correcly. There is a program called DLportIO, that checks the status of your PP. Therefore you can first run this to check the value of the 0x37A, then run your program (which should change bit 5 of the 0x37A) and the run DLportIO again to check whether that bit was changed correctly.
That is what i would do. So if you see that is changed correctly, you rule out this possibility and look for the next one!

Hope i helped you.
This threat maybe help you https://www.electro-tech-online.com/threads/dtmf.14200/
 

romaihi

New Member
first the value of the control lines were 204 so i tried to set the 5th bit by using the out function by using "out 890,32" which 32 will set the fifth bit but when i try to read the value i get 192!!! i dont know why , i cant use the data lines . i dont know if i done something wrong this is my code

Private Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Private Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Private Sub Command1_Click()
Dim x As Byte
Out 890, 32
x = Inp(890)
Label1.Caption = x
End Sub

Private Sub Form_Load()
Label1.Caption = Inp(890)
End Sub

regards,
romaihi
 

romaihi

New Member
i even tried to set all the bits to 1 and when i try im getting 223 where all the bits are 1 except the 5th bit which i need to set , please if anyone know how to deal with problem please help me .

and by the way im using inpout32.dll in the system dir in order to use the input and output function and everything is working fine except this thing

thaanks,
Romaihi.
 

demestav

Member
hello again.
Well first of all i would not use 0x20 (dec 32) because you change the rest of the bits and that maybe is not ok (i dont know).

To try and see if this is the problem set control line (0x37A) to 11100000 (that is 0xE0),since you told me that the initial state was 0xC0. Now see if it works.


If that was the problem you should change your code to:
a) take the value of the control line and store it (for example in var_temp)
b) then change ONLY the bit 5 using OR gate, at least that is how i do it (var_temp = var_temp OR 0x20)
c) output that value (output var_temp)

Hope i helped. Good luck.
 

williB

New Member
romaihi you say that you are getting 192 back after writing a 32..
the problem i think , is that you have nothing to capture the vavue you are outputting..
the port may well be working properly , the strobe indicates when a value is output , by going low, but you have no latch to grab this value, when the strobe occurs..
 

Dialtone

New Member
Parallel ports defined as ECP only in Bios setup can be troublesome at times when trying to manipulate them as bi-directional. Try setting the port to "Normal" or "EPP+ECP" in BIOS if available then re-run your test.

The only really far out thing I have encountered is resetting the EPP timeout bit (Status port bit 0). To reset it your program must write a "1" to it. Go figure.

Dialtone
 

romaihi

New Member
thank you everybody for ur replies

well as Dialtone said i changed BIOS setting and its working fine it first it was in the ECP mode but when i changed it to EPP its working perfectly

thank u all again
 
Status
Not open for further replies.

Latest threads

Top