PS/2 Keyboard To 16x2 LCD

Questions and Comments on All Tutorials

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

PS/2 Keyboard To 16x2 LCD

Postby ThePyroElectro » Thu Sep 29, 2011 4:57 am

PS/2 Keyboard To 16x2 LCD

This article will further build upon the PS/2 Keyboard Interface design by modifying the PS/2 interface so that output is displayed onto a 16x2 LCD. We are not looking to do anything fancy yet, just a simple input and output system. This article will quickly explain PS/2 theory and then focus on how to build a PS/2 Keyboard to 16x2 LCD interface.



Questions & Comments?

rccds
Newbie Pyro
Posts: 3
Joined: Sat Sep 24, 2011 5:15 pm

Postby rccds » Wed Oct 12, 2011 5:14 pm

Hello Pyro

I have to make a device like your video, but i'm not a expert in programming..

Can you help me with the source code?


Thanks

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Wed Oct 12, 2011 5:51 pm

Sure, what help do you need? What questions do you have?

rccds
Newbie Pyro
Posts: 3
Joined: Sat Sep 24, 2011 5:15 pm

Postby rccds » Wed Oct 12, 2011 8:15 pm

Thanks man,

My question is about the codes..

How many codes i have to do?

What do you do with the protocol?

Do you have any example about the routine in the main program?
I'm using the PIC 16F874A.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Thu Oct 13, 2011 4:43 pm

You could use the PIC 16F874A to do this project, but you would have to translate the code to PIC16 assembly or use microchip's HiTEC C compiler.

To do this you will have to look through the PS/2 protocol and understand it very well. Then you'll have to figure out how you want to design the system to work with the PIC16 and get programming.

There's no easy way around this, get the PIC datasheet out, and PS/2 protocol guides and get programming.

If you have specific questions I can help you.

rccds
Newbie Pyro
Posts: 3
Joined: Sat Sep 24, 2011 5:15 pm

Postby rccds » Thu Oct 20, 2011 1:52 am

Hi Pyro,

What is the baud rate that you used in the code for the keyboard PS/2?

I will make the code by rs232 with the Tx and Rx pins.

Thanks

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Postby ThePyroElectro » Thu Oct 20, 2011 6:58 pm

Hi rccds,

I used an interrupt-on-change which detected the PS/2 clock transitions, so no specific baud rate was used.

Typically keyboards use a 20 to 30 Khz frequency for their clock signal. I'm not sure how well a UART would work with the PS/2 protocol, but I'm sure it could 'work' to at least some degree of success.

dn.lahiru
Newbie Pyro
Posts: 1
Joined: Fri Jan 27, 2012 3:27 pm

Re: PS/2 Keyboard To 16x2 LCD

Postby dn.lahiru » Fri Jan 27, 2012 3:42 pm

hi,

im trying to interface 16x2 LCD module to ps/2 keyboard through pic16f877a microcontroller.

i dont have any library files that you initialized in the c code ( that is capture.h,timers.h,delays.h) can u please send me those files.

and also i have several questions,
1) can i use 4 MHz clock ?
2) is there any difficulty to capture first fall-down clock edge or are we need to implement any hardware part to delay the clock speed.??

3)its little bit hard to me to understand capture part in the c code that you provided, please can u explain more about how u get the data form D0 pin while capturing CCP1 pin.?

thanks :)

Danielbr
Newbie Pyro
Posts: 2
Joined: Sun Jul 20, 2014 2:27 am

Re: PS/2 Keyboard To 16x2 LCD

Postby Danielbr » Sun Jul 20, 2014 2:37 am

Hello,

I've been trying to compile the code for the PIC18F4550 but I'm having trouble with some errors.

I'm using MPLAB v8.92. When I try to compile using CCS C Compiler, following error appears:

*** Error 128 "C: \ Users \ Daniel \ Desktop \ keyboard \ p18f4550.h" Line 10 (1,2): A # DEVICE required before this line


But when I try to use the HI-TECH compiler ANSI C COMPILER, following error:

Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 209.1 unknown pragma "code"
Error [195] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 212.1 expression syntax
Error [312] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 215.1 ";" expected
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 216.1 unknown pragma "code"
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 217.1 unknown pragma "interrupt"

********** Build failed! **********


How can I be solving this problem?

Thank you

Daniel.

ThePyroElectro
PyroElectro Admin
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

Re: PS/2 Keyboard To 16x2 LCD

Postby ThePyroElectro » Sun Jul 20, 2014 3:36 am

Danielbr wrote:Hello,

I've been trying to compile the code for the PIC18F4550 but I'm having trouble with some errors.

I'm using MPLAB v8.92. When I try to compile using CCS C Compiler, following error appears:

*** Error 128 "C: \ Users \ Daniel \ Desktop \ keyboard \ p18f4550.h" Line 10 (1,2): A # DEVICE required before this line


But when I try to use the HI-TECH compiler ANSI C COMPILER, following error:

Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 209.1 unknown pragma "code"
Error [195] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 212.1 expression syntax
Error [312] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 215.1 ";" expected
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 216.1 unknown pragma "code"
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 217.1 unknown pragma "interrupt"

********** Build failed! **********


How can I be solving this problem?

Thank you

Daniel.


This code was written for the C18 compiler.

Use the C18 compiler provided for free at http://www.microchip.com or re-write the code for use with the CCS compiler.

Danielbr
Newbie Pyro
Posts: 2
Joined: Sun Jul 20, 2014 2:27 am

Re: PS/2 Keyboard To 16x2 LCD

Postby Danielbr » Tue Jul 22, 2014 4:27 pm

ThePyroElectro wrote:
Danielbr wrote:Hello,

I've been trying to compile the code for the PIC18F4550 but I'm having trouble with some errors.

I'm using MPLAB v8.92. When I try to compile using CCS C Compiler, following error appears:

*** Error 128 "C: \ Users \ Daniel \ Desktop \ keyboard \ p18f4550.h" Line 10 (1,2): A # DEVICE required before this line


But when I try to use the HI-TECH compiler ANSI C COMPILER, following error:

Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 209.1 unknown pragma "code"
Error [195] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 212.1 expression syntax
Error [312] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 215.1 ";" expected
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 216.1 unknown pragma "code"
Warning [335] C: \ Users \ Daniel \ Desktop \ keyboard \ teclado.c; 217.1 unknown pragma "interrupt"

********** Build failed! **********


How can I be solving this problem?

Thank you

Daniel.


This code was written for the C18 compiler.

Use the C18 compiler provided for free at http://www.microchip.com or re-write the code for use with the CCS compiler.




Thanks for the reply.

I installed the C18 compiler on my computer but when I compile the code in MPLAB is showing the following error:

Can not create directory `C: \ MCC18 \ lib C: \ '. The Win32 error code is: 123

I tried on other computers running windows 32 bits and the same error is displayed.

Thanks
Daniel


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 4 guests