Question - Pic 18F25K50 - HID Keyboard 4X5

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Question - Pic 18F25K50 - HID Keyboard 4X5

Post by seokgi »

I would like to use the PIC 18F25K50 to create a keyboard that works like a computer keyboard (4X5). So I made a keyboard and read key values. However, I did not succeed in connecting the HID USB Keyboard to my computer. Perhaps it is because the 18F25K50 's Config is wrongly selected and the HID Component is not used well. I hope some of you guys will help me out. Please help me.
Attachments
GetKey.fcfx
(25.36 KiB) Downloaded 179 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Question - Pic 18F25K50 - HID Keyboard 4X5

Post by Benj »

Hello,

I'm assuming you're using a 16MHz crystal. If so then this should hopefully work correctly for you.
Attachments
GetKey.fcfx
(25.35 KiB) Downloaded 190 times

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: Question - Pic 18F25K50 - HID Keyboard 4X5

Post by seokgi »

I did what you sent me and it was recognized as HID K / B. However, no matter how I try, I can not send keyboard values. It works well with HID Serial. I do not know what I did wrong. For example, the format of the data or another. Teach me a little more. Give me a hint if you get tough. I have to worry about doing this quickly. Please, please.
Attachments
GetKey.fcfx
(26.56 KiB) Downloaded 180 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Question - Pic 18F25K50 - HID Keyboard 4X5

Post by Benj »

Hello,

Your variable Data_HID should be changed to 8 bytes instead of 10.

To then add the key press you want you need to correctly assign the data to the Data_HID variable.

A complete list of scan codes for a US keyboard can be found here.
https://gist.github.com/MightyPork/6da2 ... 55fdc73db2

To send a '*' character you would assign the data like this.

Data_HID[2] = 0x55

Send the data and then clear the buffer to reset the key press.

Data_HID[2] = 0

Here are some more key values from your program

F1 -> Data_HID[2] = 0x3A
F2 -> Data_HID[2] = 0x3B
'1' -> Data_HID[2] = 0x1E
'2' -> Data_HID[2] = 0x1F
'3' -> Data_HID[2] = 0x20
UP Cursor ->Data_HID[2] = 0x52

Here's a modified version of your program.
GetKey.fcfx
(26.98 KiB) Downloaded 201 times

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: Question - Pic 18F25K50 - HID Keyboard 4X5

Post by seokgi »

Thank you very much for your help.
HID KB does not work even if you modify it as taught. In Device Manager, it is well recognized as HID KB. But the KB is still not working. And I do not know the meaning of Key UP Icon and Hid_Data [??]. Let me know where it is described and I will study. I do not speak English well so my meaning is well communicated. If you do not help me, I probably will not be using FC. Probably in Korea, I seem to be using my own.
Thank you.
Attachments
GetKey.fcfx
(23.68 KiB) Downloaded 178 times

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: Question - Pic 18F25K50 - HID Keyboard 4X5

Post by seokgi »

I'm just finished that.
USB HID component error. I copyed new component. That solved.

Thank you.

Post Reply