AT/PS2 Keybord - PIC Interface?


Closed Thread
Results 1 to 40 of 74

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default PS/2 to 18F4620 timing issues with mytekcontrols code?

    Hello!

    I have implemented the wonderful code PS/2 keyboard code from mytekcontrols in my PIC18F4620. It will only work if I set
    TOcntDLY CON to a value of 100 (originally set to 10 per mytekcontrols).

    Furthermore, if I hit and hold any of the these three keys (Caps Lock, Num Lock, or Scroll Lock), there is no response from the keyboard LEDs and the program just hangs. These keys will work if I hit them VERY quickly (less than .1 second - just hit with a glancing blow).

    Everything else works as it should (with the CON change above).

    Is this a big timing issue for me? Settings when programming?

    Reference:
    PIC 18F4620
    Internal OSC at 8Mhz
    OSCCON = %01110010
    BUT even with an external 20Mhz oscillator, same performance, still hangs!

    I sense severe timing issues. I will welcome all suggestions with regard to fixing this code for me.

    Thank you to all,
    Bob Pigford
    Newark, Delaware

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default May not be

    Hi,

    I used it on a 40MHz oscillator and did not have any issue. However the following may be considered:

    1. Allow enough time (2 seconds or more is safe) before calling the PS2init routine. Your keyboard needs this to boot-up. Indicated by all three LEDs flashing and going off.

    2. The characters are stored using interrupts but the interrupts are re-enabled only when parse it. This may cause the keyboards internal buffer to be overwhelmed.
    Regards

    Sougata

  3. #3
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default PS/2 to 18F4620 timing issues with mytekcontrols code?

    Thank you sougata,

    Quote Originally Posted by sougata View Post
    Hi,

    I used it on a 40MHz oscillator and did not have any issue. However the following may be considered:

    1. Allow enough time (2 seconds or more is safe) before calling the PS2init routine. Your keyboard needs this to boot-up. Indicated by all three LEDs flashing and going off.

    2. The characters are stored using interrupts but the interrupts are re-enabled only when parse it. This may cause the keyboards internal buffer to be overwhelmed.
    I did allow enough time for the keyboard to start. I see the LEDs flash, so I think that is not the issue.

    I will follow you suggestion and look into the buffer situation. I will also order a 40mhz oscillator just to be sure.

    I will report back on my progress.

    Thank you again,
    Bob Pigford
    Newark, Delaware, USA

  4. #4
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default PS/2 to 18F4620 timing issues isolated to "putkey" routine

    Quote Originally Posted by BobPigford View Post
    Thank you sougata,



    I did allow enough time for the keyboard to start. I see the LEDs flash, so I think that is not the issue.

    I will follow you suggestion and look into the buffer situation. I will also order a 40mhz oscillator just to be sure.

    I will report back on my progress.

    Thank you again,
    Bob Pigford
    Newark, Delaware, USA
    I just isolated the issue! If I eliminate any output going TO the keyboard, everything works just fine! I disabled the "putkey" routine buy placing a "RETURN" immediately after the beginning of the routine.

    Even with the internal oscillator at 8mhz, it all works very well (even with "TOcntDLY set back to 10)! I can live without seeing the LEDs on the keyboard for now. When my 40mhz oscillator arrives, it will try it again and report back.

    Regards,
    Bob

  5. #5
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Use HSPLL

    Hi,

    Every PIC18 has got a x4 HSPLL oscillator mode. So you can use an external 10MHz crystal to effectively get 40 MHz Fosc. For internal 8MHz you need to configure osccon to enable HSPLL and get 8 x 4 = 32MHz from the internal oscillator.
    Regards

    Sougata

  6. #6
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Will try HSPLL

    Quote Originally Posted by sougata View Post
    Hi,

    Every PIC18 has got a x4 HSPLL oscillator mode. So you can use an external 10MHz crystal to effectively get 40 MHz Fosc. For internal 8MHz you need to configure osccon to enable HSPLL and get 8 x 4 = 32MHz from the internal oscillator.
    Thank you Sougata. I will give this a try and report back. And thank you for teaching me about HSPLL.
    Regards,
    Bob

Similar Threads

  1. MXcom "C-BUS" interface to PIC question
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st May 2014, 03:59
  2. Interface a pic with a Iphone/Itouch
    By Luckyborg in forum General
    Replies: 1
    Last Post: - 6th May 2009, 16:02
  3. 4 pin 4 x 4 keypad interface using pic basic pro
    By dunlao_john in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th January 2009, 05:21
  4. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 16:04
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts