ps2 keybord test routing

General discussion on mikroC.
Post Reply
Author
Message
MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

ps2 keybord test routing

#1 Post by MENDIS » 08 Sep 2010 14:44

hi,
i try display ASCII character on 2x16 LCD display received from ps2 keyboard.but this code is not work.anybody please help me.

Code: Select all

//-------------------------------------------------------------------------------

char *text = "KEY BORD TEST";

unsigned short keydata, special, down,  temp;





void main()


{
  TRISC = 0;                         // PORTB is output
  Lcd_Custom_Config(&PORTC,3,2,1,0,&PORTC,4,6,5);  // Initialize LCD on PORTB
  Lcd_Custom_Cmd(Lcd_CURSOR_OFF);           // Turn off cursor
  Lcd_Custom_Out(1, 1, text);               // Print text at LCD
  

 Ps2_Config(&PORTB, 2, 3);
 Delay_ms(100);
  
while (1)

  {
    if (Ps2_Key_Read(&keydata, &special, &down))
   {


      temp = (keydata) ;
      Lcd_Custom_Out(2, 1, temp);               // Print text at LCD
     
      Delay_ms(10);    // debounce
     delay_ms(2000);

     

  }
 }
}
//----------------------------------------------------------------
Edited by Administrator: Added Code Tag!

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: ps2 keybord test routing

#2 Post by ranko.rankovic » 09 Sep 2010 12:31

Hello MENDIS,

Consider trying our new compiler for PIC, you can find it here.
Also there is tested and working example for PS/2 within this software bundle.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

Re: ps2 keybord test routing

#3 Post by MENDIS » 09 Sep 2010 16:18

ranko.rankovic wrote:Hello MENDIS,

Consider trying our new compiler for PIC, you can find it here.
Also there is tested and working example for PS/2 within this software bundle.

Best regards

thanks for your help.i will try with new update.
mendis.

MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

Re: ps2 keybord test routing

#4 Post by MENDIS » 13 Sep 2010 16:27

hi sir,
i tested with latest micro c software but it still not work. i tested my hardware setup with old mikrobasic its working fine.please help to me work with micro c.

thanking you,
mendis.




Code: Select all

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

unsigned short keydata = 0, special = 0, down = 0,TEMP = 0;

sbit PS2_Data            at RC0_bit;
sbit PS2_Clock           at RC1_bit;
sbit PS2_Data_Direction  at TRISC0_bit;
sbit PS2_Clock_Direction at TRISC1_bit;

void main() {

  Lcd_Init();                        // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  
   Lcd_Out(1,1,"PS2 TEST");


  Ps2_Config();                                       // Init PS/2 Keyboard
  Delay_ms(100);                                      // Wait for keyboard to finish

  do {
    if (Ps2_Key_Read(&keydata, &special, &down)) {
         TEMP = keydata;
        // Lcd_Out(2,2,TEMP);
      }

      else if (down && !special && keydata) {
      
       TEMP = keydata;
       Lcd_Out(1,12,TEMP);
      }

    Delay_ms(10);                                      // debounce
  } while (1);
}

MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

Re: ps2 keybord test routing

#5 Post by MENDIS » 16 Sep 2010 01:59

support team no any solution for this problem ?

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: ps2 keybord test routing

#6 Post by ranko.rankovic » 24 Sep 2010 11:17

Hello MENDIS,

Take a look at our examples that come within software bundle. There is a PS/2 example and LCD 2x16 example, combining those two you can achieve what you need.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

Re: ps2 keybord test routing

#7 Post by MENDIS » 28 Sep 2010 12:14

ranko.rankovic wrote:Hello MENDIS,

Take a look at our examples that come within software bundle. There is a PS/2 example and LCD 2x16 example, combining those two you can achieve what you need.

Best regards
HELLO,
see this i used those examples but PS2 routing not work.Please refer above codes.

thanks.

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: ps2 keybord test routing

#8 Post by ranko.rankovic » 01 Oct 2010 12:12

Hello MENDIS,

Can you try out examples that come within compiler if they work. Can you confirm this?

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

MENDIS
Posts: 11
Joined: 08 Jul 2010 07:30

Re: ps2 keybord test routing

#9 Post by MENDIS » 05 Oct 2010 11:53

ranko.rankovic wrote:Hello MENDIS,

Can you try out examples that come within compiler if they work. Can you confirm this?

Best regards
hello,
yes confierm it. its working fine with mikrobasic but it doesnt work with MIKROC.

BR.

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: ps2 keybord test routing

#10 Post by ranko.rankovic » 08 Oct 2010 07:12

Hello MENDIS,

I tried all our examples, for mP, mB and mC with EasyPIC6 and standard PS/2 keyboard, and all are working flawlessly. Can you pack your project and attach to this thread to inspect it.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Post Reply

Return to “mikroC General”