Shop OBEX P1 Docs P2 Docs Learn Events
can't transfer WKPND_b to W in PS2 keyboard code — Parallax Forums

can't transfer WKPND_b to W in PS2 keyboard code

TransistorToasterTransistorToaster Posts: 149
edited 2006-08-10 19:32 in General Discussion
Hello,
I am debugging an interrupt controlled clocked serial reveiver for an AT PS2 keyboard. My problem is that I am not getting always 11 interrupts for a 1 start +8 data +1 parity+1 stop bit frame of 11 clock cycles. I see this by my data being misaligned by 1 bit (it happens in both directions) and also the downcounter I use for the quantity of bits received not equal to 0 after 11 interrupts.

QUESTION:
I would like to read the WKPND_B register, but the compiler is rejecting the second line of this piece of code:

mov M, #$09 ;WKPND_W get B change interrupt status register
mov w, !rb

How do I read WKPND_W?

Or does somebody have and ISR for a PS2 keyboard I could work with?
Frank

Comments

  • BeanBean Posts: 8,129
    edited 2006-08-10 19:32
    Frank,
    When you access the WKPND_B register via "MOV !RB,W" it does a SWAP with the W register.
    So the contents of W get put INTO WKPND_B and the previous contents of WKPND_B get put back into W.

    MOV M,#$09
    MOV W,#0
    MOV !RB,W ; This swaps the values in WKPND_B and W

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
    ·
Sign In or Register to comment.