Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Sending Commands to Keyboard from PIC 18F452

Status
Not open for further replies.

designer

Newbie level 4
Joined
Nov 4, 2003
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
85
18f452 keyboard

i am corrently interfacing keyboard to pic 18f452. when command to turn on 'caps/num' is given to the kbd, the keyboard hangs .

Host to Keyboard code is as follows

void SendKbdCmd(unsigned char cmd)
{
unsigned char cnt, par=0, mask=0x1;

INTCONbits.GIE = 0;
KbXmit=1;
while(!kbdClk);
TRISKbdClk = 0;
kbdClk=0;
Delay10TCYx(25);
TRISKbdDat = 0;
kbdDat=0;
TRISKbdClk = 1;
while(kbdClk);
for(cnt=0; cnt<8; cnt++)
{
if(cmd&mask)
{
par++;
kbdDat=1;
}
else
kbdDat=0;
mask<<=1;
while(!kbdClk);
while(kbdClk);
}
kbdDat=!(par%2);
while(!kbdClk);
TRISKbdDat = 1;
while(kbdClk);
INTCON3bits.INT1IF=0;
INTCONbits.GIE = 1;
}
 

go to h**p://www.beyondlogic.org
They have a couple of articles on interfacing to a pc keyboard. Might help?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top