I recently got my K8031 working but now im facing a new problem with my other computer. It works fine with the two laptops i have but i want to use it with my lab computer. When i plug in K8031 in the parallel port (in a real LPT port on the motherboard) and start PC lab it says that it cant make any connection with K8031. I have tested a several different modes in BIOS but none seems to work. I have a program that lets me view the LPT pins state. It says that Pin 14 is blinking when in run mode. Pin 2, 3 and 4 is always zero. If i manually activate 2 or 3 or 4 i recive input from K8031 and PC lab shows a signal but only one time. It seems to be either Windows or PC lab that is the problem.
I have now solved the problem. I dont know exacly why but on my computer the LPT pin 8 has be on all the time. It might have someting to do with the voltage output from the computer to K8031. To solve this problem i had to modify K8031.exe file in PClab2000SE. I recoded it so when pclab resets the output (387) to 0FFh it resets to 0BFh insted. Changing to to 0BFh insted of 0FFh will result 10111111 which means that bit 7 is not changed when the pc is sending data to K8031. If there are other with similar problem i can send you the modified K8031.exe.
It’s good to see you got your K8031 working.
This problem with the pin 8 of the LPT port seems strange.
Indeed, the main purpose of the pins 6, 7, 8 and 9 is to feed supply voltage to the optocouplers.
Also this pin 8 is feeding the pull-up resistor R41 for the optocoupler IC18.
Your solution seems to work but I don’t really understand it…
If you look this code snippet you’ll see that the pin 8 is set several times ON when the data is read from the K8031.
I thik you didn’t modify every instance…?
[code] asm
push ebx
push esi
push edi
mov edi,p2 {ds:BX = K save address }
mov esi,p2
add esi,2*8192 {save address}
mov dx,pr_portti
add dx,2
in al,dx
or al,00000010b {244 on}
mov ecx,5
@lo1:
out dx,al
loop @lo1
mov dx,pr_portti
mov ecx,cnt
@lo_16:
mov al,11111111b
out dx,al
out dx,al
mov al,11111101b
out dx,al
out dx,al
loop @lo_16
mov ecx,4096 {number of samples}
@looppi2:
xor bx,bx
mov al,11111101b
out dx,al
out dx,al
inc dx
in al,dx
in al,dx {b3, b7 now al bits b5 b6}
shl al,2 {b3 --> b7, b7 --> cf}
rcl bl,8 {b7 --> bl b7}
and bl,10000000b
or bh,bl
rol al,4
and al,00001000b
or bh,al
dec dx
mov al,11111100b
out dx,al
out dx,al
inc dx
in al,dx
in al,dx {b1, b5 now al bits b5 b6}
shl al,2 {b1 --> b7, b5 --> cf}
rcl bl,6 {b5 --> bl b5}
and bl,00100000b
or bh,bl
rol al,2
and al,00000010b
or bh,al
dec dx
mov al,11111111b
out dx,al
out dx,al
inc dx
in al,dx
in al,dx {b2, b6 now al bits b5 b6}
shl al,2 {b2 --> b7, b6 --> cf}
rcl bl,7 {b6 --> bl b6}
and bl,01000000b
or bh,bl
rol al,3
and al,00000100b
or bh,al
dec dx
mov al,11111110b
out dx,al
out dx,al
inc dx
in al,dx
in al,dx {b0, b4 now al bits b5 b6}
shl al,2 {b0 --> b7, b4 --> cf}
rcl bl,5 {b4 --> bl b4}
and bl,00010000b
or bh,bl
rol al,1
and al,00000001b
or bh,al
dec dx
xor ax,ax
mov al,bh
mov ds:[esi],ax
add summa,eax
add esi,4
loop @looppi3
jmp @ready
@looppi3:
jmp @looppi2
mov eax,summa
@ready:
mov eax,summa
shr eax,12
mov ecx,16
@lop:
mov ds:[esi],ax
add esi,4
loop @lop
mov dx,pr_portti
mov al,0ffh
out dx,al {supply voltage to optocouplers}
add dx,2
in al,dx
and al,11111101b {244 off}
out dx,al
pop edi
pop esi
pop ebx
end;[/code]