No Keyboard!
Newzed
Posts: 2,503
I am absolutely baffled.· Day before yesterday both the keyboard and mouse were working perfectly.· Yesterday and today neither will work.
Here are the keyboard connections:
keyboard pins 24 and 25· 'Both verified for input and output
Power - 5VDC
Ground - Vss
Clock and Data pullted high with 10K to 3.3VDC
Data to pin 24
Clock to pin 25
Keyboard is OK - checked on another computer
When the board is powered up all three little LEDs flash rapidly.· When the program is loaded the three LEDs stop flashing.
I have attached copies of my Keyboard Demo.spin and of keyboard.spin.
Can someone please help.· I'm going mad!!
Sid
Here are the keyboard connections:
keyboard pins 24 and 25· 'Both verified for input and output
Power - 5VDC
Ground - Vss
Clock and Data pullted high with 10K to 3.3VDC
Data to pin 24
Clock to pin 25
Keyboard is OK - checked on another computer
When the board is powered up all three little LEDs flash rapidly.· When the program is loaded the three LEDs stop flashing.
I have attached copies of my Keyboard Demo.spin and of keyboard.spin.
Can someone please help.· I'm going mad!!
Sid
Comments
Try this code that I have attached and let me know if it works?
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
Http://www.parallax.com
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
Chip Gracey
Parallax, Inc.
The Keyboard_Demo.spin·(above works just fine in my setup my own breadboard, Propstick and Parallax demo board))
Here is the problem.· Sunday, both the mouse and the keyboard were working perfectly. Since Monday morning, neither will work.· I have a
breadboard with two PS2 jacks, one for the mouse and one for the keyboard.· I have indicated the connections in my original post above.· I do n ot think there is anything wrong with my Propeller.· I have run many of the examples Dave Scanlan posted.· Every program works fine as long as it does not have a keyboard or mouse object.
My question is:· What single thing could have happened that rendered both the keyboard and mouse inoperative?· Why do the three little keyboard LEDs flash rapidly when the keyboard is powered up, then go off when the program is loaded?· I can't use my scope because it is on the workbench attached to a computer that has ME and the Propeller Tool won't run on ME.· Is there anything I can look at or test that might tell me where the problem is.· The two pins for the keyboard, 24 and 25, have been checked to make sure they work both as an input and an output.
I'm going to strip my PS/2 breadboard and rebuild it.· We'll see what happens.
Sid
The program said:
· 'start the keyboard
· kb.start(24, 25)
· If KB.Present·····················
··· term.str(string("KEYBOARD CONNECTED"))
··· term.Out(13)
··· Repeat
····· term.out(KB.GetKey)
· Else
··· term.str(string("ERROR: KEYBOARD NOT CONNECTED"))
Then.......I deleted the If/Else statements.· Now the screen displays just the title string and the keyboard works.
I would like to use the If/Else statements if someone can tell me what I'm doing wrong.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
Sid
I think you've run into your first multi-processing bug! The keyboard isn't 'present' until about 150ms AFTER it is started. That's how long it takes to receive the reset command and clear its head. Meanwhile, it shows 'not-present'. You could add a line after the kb.start to fix this:
waitcnt(clkfreq/5 + cnt)· 'wait for 1/5 second (200ms)
I periodically forget to allow for things like this and I've been really stumped on several occasions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Sid
Sorry. It might need more time than that. Try this:
waitcnt(clkfreq * 2 + cnt)···· 'wait for 2 seconds
This may not even be the problem, afterall, but I think it is.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Just to prove your sanity...
term.out(kb.present)
If it's there, it should return a -1, otherwise a 0
...
Next, you said that if you remove the if then, it works, correct?
Lastly, One of my favorite debuggin tools is to remove "implied" and specify.
IF KB.Present == True
...
...
ELSE
...
I tried... [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket
KK
·
term.out(kb.present) won't work.· If it is a 1, the TV will do nothing.· If it is a 0, it is the same as saying term.out(0), which clears the screen.
I tried
if kb.present == True
and that worked.· Screen said "Keyboard connected".· Chip, I kept reducting the pause after kb.start.· "waitcnt(clkfreq/2 + cnt)" was as short as I could go and stll make it work··- that's 500ms..
I wrote
if kb.present
.....
,,,,
else
and it still worked so the problem was the lack of a suitable pause after· kb.start.
Thanks to both of you.· Now the "kb.present" check routine works fine.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
While writing a keyboard handler I was running into the numeric outputs being used as control codes (ie clear, color, etc)
So what I did was force it into the ascii numeric range (48..57), so I could actually see what was getting returned.
For example, something like Term.out(49+KB.present)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket
KK
·