Attached is a program I have tried. I see data going out of the data pin and the clock on the scope. But I do not get anything on the dos screen (DOS 6.22).
I strobe the switch looking for a High, and then set and LED on when I get it, for some reason I do not see any data on the screen.
I have tried all of the modes for the shiftout command but nothing seems to work.
I am using pins +5 and Ground on the PCB connector, and then 1 and 5 on the connector. I have even jumpered 1-2 and 5-6 thinking I am looking at the wrong end of the cable. but nothig works.
Any help would be appreciated.
USB would be great, but I need PS/2.
Thanks,
HH
' PIC 16F688
' PortC.5 - Data
' PortC.4 - Clk
' PortA.2 - Switch in, normal low, active high
' PortA.0 - LED Out, high if switch pressed
' Circuit description
' 10K pull up on PortC.5 - Data
' 10K pull up on PortC.4 - Clk
' 10K pull up on /MCLR
' 10K pulling down on switch input, PortA.2
'Goal of program, to send a chracter to the PC keyboard port when switch is pressed
INCLUDE "modedefs.bas"
DEFINE OSC 4 ' 4 Mhz
TRISA = %00000100 ' Set PORTA.2 to input, all others are output
TRISC = %00000000 ' set PORTC to outputs
CMCON0 = 7 ' turn off comparitors
ANSEL = %00000000 ' set all as digital ports, analog off
char var word
breakcode var word
char = %11100011110 '/a
breakcode = %11111000000 '/F0H
'----- Main Loop --------------------------------
Start: ' loop start
low porta.0 ' turn off LED
if PORTA.2 = 1 then ' check switch, if pushed then LED on and Char our
high porta.0 ' LED on
call sendchar ' send characters
endif
goto start ' restart loop
sendchar:
char = %11100011110 '/a
shiftout portc.5,portc.4,4,[(char)\11] ' LSB first, Clk High
shiftout portc.5,portc.4,4,[(breakcode)\11]
shiftout portc.5,portc.4,4,[(char)\11]
char=%11010010100 '/CR
shiftout portc.5,portc.4,1,[(char)\11] ' MSB first, Clk low
shiftout portc.5,portc.4,1,[(breakcode)\11]
shiftout portc.5,portc.4,1,[(char)\11]
char=%11011001110 '/b
shiftout portc.5,portc.4,1,[char\11] ' MSB first, Clk low
shiftout portc.5,portc.4,1,[breakcode\11]
shiftout portc.5,portc.4,1,[char\11]
char=%11100101110 '/t
shiftout portc.5,portc.4,5,[(char)\11] ' MSB first, Clk high
shiftout portc.5,portc.4,5,[(breakcode)\11]
shiftout portc.5,portc.4,5,[(char)\11]
char=%10100101100 '/r
shiftout portc.5,portc.4,0,[(char)\11] ' LSB first, Clk low
shiftout portc.5,portc.4,0,[(breakcode)\11]
shiftout portc.5,portc.4,0,[(char)\11]
char=%10011101110 '/d
shiftout portc.5,portc.4,1,[char\11] ' MSB first, Clk low
shiftout portc.5,portc.4,1,[breakcode\11]
shiftout portc.5,portc.4,1,[char\11]
pause 100
return
Bookmarks