How to interface PC keyboard to uC...

Discussion in 'Embedded Systems and Microcontrollers' started by RRITESH KAKKAR, Jun 20, 2013.

  1. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    Hi,

    I want to connect the PC/AT keyboard to PIC16f877a.
    will RS232 will work with it?? and how to know its baud rate?
     
  2. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
  3. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    OK, i have readied that link..
    and now how to start programming for this?

    [​IMG]
     
  4. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Last edited: Jun 20, 2013
  5. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    How to start programming?

    Get compiler. Write code.
     
  6. Meixner

    Member

    Sep 26, 2011
    116
    21
  7. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89

    OK, i have seen that link and understand the process..but what is the use of using buffer..and capture is working?

     
  8. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    can any one suggest me?
     
  9. Dawud Beale

    Member

    Feb 10, 2012
    275
    7
    It looks like you are trying to use an RS232 serial data link. A UART/USART.

    Are you supposed to programme it in C or Assembley?

    I presume this is for a university project?

    The baud rate will be 9600 to answer your question

    Does it have to be a software or hardware UART?

    I had to do the same project and also I use the same PIC your using on a 44 pin demo board
     
  10. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    Hi ,
    I am doing in C for connecting it with led display..
    all keyboard work with uart?
     
  11. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    Hi again,

    i am using this code for display keyboard char to terminal window at show 'k' as per testing serial comm. after that 0xFB is coming cont pressing keyboard is doing nothing,why???
     
  12. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Where did you get this code Ritesh? Some link to the site you took this code from would be useful. As I doubt you have written this by your self
     
  13. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    762
    Hola RRITESH,

    I see that for every new subject you start dealing with, you start as well a long thread of serial questions that, I have to tell you, shows that you do not read in detail whatever info is available.

    I taught my micro 18F4520, starting from zero knowledge in this matter, to communicate with an optical mouse. As me, many before, let me tell you, did it with success.

    Sure I look rude but you are lazy and insist in showing that. Instead of thinking and trying to understand info available in the Web, which by now, is a LOT, you come to the forums and shot a question. And another. And another...with no end.

    That is horrible. I am convinced that you do not want really learn things.

    I've reread many of your questions in your posts. You are not refraining yourself of that impulsive posing of question that could be replaced by judicious testing and attentive reading.

    Do you know what testing a design is? Just noticing that it doesn't work as expected and then immediately running to post asking why?

    This post is long, I know. Do not worry, I am not going to be in your way again as I never was in the past. For sure.
     
    absf, Eric007 and Brian Griffin like this.
  14. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    Here it is i searched for 0xFB it is used for 0xfb Set a single key to repeat.
    one more question we receive data from keyboard can we send data also to keyboard but what the use of sending data to keyboard from PC, i am confused with tutoial.
     
  15. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I wish I could disagree with Atferrari, but alas, I cannot. Rritesh, you do have a terrible habit of asking endless questions here rather than doing any research of your own, and then not responding to the suggestions you get.

    In the case of the reference you gave, almost the first thing I saw when I looked there was "Furthermore, the keyboard interface allows bidirectional data transfers so the host device can illuminate state LEDs on the Keyboard."

    Here at Allaboutcircuits, you're asking "what the use of sending data to keyboard from PC". So now I have to wonder, is this a guy who reads his reference material, or is he someone who just won't do any work? And if he asks for help, do I want to offer any?
     
  16. Eric007

    Senior Member

    Aug 5, 2011
    1,044
    33
    Rritesh does not have the spirit of an engineer but that of a *technician* who wants to get the job done without necessarily understanding what is going on...

    Maybe He just want it done just to get paid or...I might be wrong but I'm surprised to see that after so many projects he has discussed he still hasn't matured yet!

    I would understand when discussing your very first projects, like first 3 - 5 projects, but after that and with all the guidance, approaches provided here on this forum...you should have matured by now and know how to tackle projects!

    Looks to me like you still don't know how to approach design, break it down, do researches, reading datasheets, ..., and use common sense!

    You are really terrible! and what makes you terrible is the way you put it on the forum...If I have to discuss something here, that I am not familiar with, people will tell that I've thought about it for long and have done some high level design breakdown, have done proper researches and they will be willing to put me in the right direction...

    And I told you that before that the *way* you ask questions put people off...

    Anyways, all I'm trying to say is you need to improve on your way of doing things when it comes to engineering...

    Like me right now I busy reading books to get basic concepts right and datasheets so when I come here I don't get shouted by big boys here :) ! it has happened before...but I was still very new...but you are nomore a newbie Rritesh, huh!

    Anyway All the best!:)
     
    Brian Griffin likes this.
  17. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    0xFB Scancode for key Set specific key to typematic/autorepeat only (scancode set 3 only)
    but when i press any key then also it does not change why??
     
  18. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    I have noticed one thing the uc is sending cont 0XFB ...
    just for checking i have disconnected the Vcc from PS/2 and some time shorted the Data with gnd for testing to see some changes on terminal wind but nothing happen don't know why??

    i think some problem is here it is not updating scan code from keyboard.

    Code ( (Unknown Language)):
    1.  
    2. while(1)  
    3.   {       ch=Scan_Data;
    4.  Hserout( ch);
    5.  __delay_ms(1000);  
    6.  ch=0;          
    7.  Capture_init();//Initialise once again for next capture  
    8.    }

    The problem is something else i have disconnected 3 wires from ps/2 to uC then also FB is coming cont...
     
    Last edited: Jun 30, 2013
  19. RRITESH KAKKAR

    Thread Starter Senior Member

    Jun 29, 2010
    2,831
    89
    HI,

    i have noticed in this many problem i have wasted time on it here is some:

    const unsigned char Key[]={"0F FFFFF FFFFt` as cQ1 ZSAW2 CXDE43 VFTR5 NBHGY6 MJU78 ,KIO09 ./L;P- ' [=\\"};
    some other also....
    any way the is not working at all..
    I have just connected my serial to USB RS232 and watching whether PS/2 is working yes it is working.
    on giving supply all 3 led blink and pressing key give serial output i don't have oscilloscope so, after changing baund rate data also changing....
     
  20. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    A thing I am puzzled about. The PS2 Keyboard communication uses a synchronous serial protocol. And hence the PIC UART should be set to work in synchronous mode, with the keyboard providing the master clock. Are you using the PIC UART in synchronous mode?
     
Loading...