naiqiqnus 发表于 2010-10-18 22:49:51

avr模拟电脑USBHID键盘,键值对应关系问题,和ASCII表对应符不符?请教!

原帖:http://www.ourdev.cn/bbs/bbs_content_all.jsp?bbs_sn=3253865
上面是用attiny45模拟usb键盘,定时发送CapsLocker(大写锁定按键)
本人疑惑代码:

reportBuffer=0;   //特殊功能键
reportBuffer=0x39;//键值
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));//上报数据

ASCII表上CapsLocker对应键值为20,这里为什么为0x39?
我自己用M8仿做一个验证,发送0x39是控制CapsLocker的。
另在其他avr模拟usbhid键盘程序中发现:
#define KEY_A       4
#define KEY_B       5
#define KEY_C       6
#define KEY_D       7
#define KEY_E       8
#define KEY_F       9
#define KEY_G       10
#define KEY_H       11
#define KEY_I       12
#define KEY_J       13
#define KEY_K       14
#define KEY_L       15
#define KEY_M       16
#define KEY_N       17
#define KEY_O       18
#define KEY_P       19
#define KEY_Q       20
#define KEY_R       21
#define KEY_S       22
#define KEY_T       23
#define KEY_U       24
#define KEY_V       25
#define KEY_W       26
#define KEY_X       27
#define KEY_Y       28
#define KEY_Z       29
#define KEY_1       30
#define KEY_2       31
#define KEY_3       32
#define KEY_4       33
#define KEY_5       34
#define KEY_6       35
#define KEY_7       36
#define KEY_8       37
#define KEY_9       38
#define KEY_0       39
#define BACK_SPACK42
#define JIA         87
#define JIAN      86
#define CHEN      37
#define CHU         56
#define ENTER       40//
#define DIAN      55

#define KEY_F1      58
#define KEY_F2      59
#define KEY_F3      60
#define KEY_F4      61
#define KEY_F5      62
#define KEY_F6      63
#define KEY_F7      64
#define KEY_F8      65
#define KEY_F9      66
#define KEY_F10   67
#define KEY_F11   68
#define KEY_F12   69
我验证了期中的数字键0-9,F3——F12均正确。
以上和ASCII表对应不符?请高人指教,谢谢!
或谁能会给一个所有按键对应的键值表,谢谢!

naiqiqnus 发表于 2010-10-18 22:50:44

自己顶!

naiqiqnus 发表于 2010-10-20 22:50:46

各位高手帮帮忙……

naiqiqnus 发表于 2010-10-21 18:26:35

是我的问题描述不清楚?还是怎么的?哪位高手给个提示啊……

bccdn 发表于 2010-11-18 17:10:34

usb114.cn-USB键盘常用码值表ourdev_598881F8XMV0.txt(文件大小:8K) (原文件名:t.txt)

来源于本论坛。

huanggua 发表于 2010-11-18 17:49:35

USB键盘 码值 和ps2的不一样。

maxims 发表于 2011-2-5 15:44:55

楼主是用STm8做了一个类似的么?

能帮帮我么?
http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=4542908&bbs_id=3020

naiqiqnus 发表于 2013-12-10 16:34:31

maxims 发表于 2011-2-5 15:44
楼主是用STm8做了一个类似的么?

能帮帮我么?


不是,是atmega8
页: [1]
查看完整版本: avr模拟电脑USBHID键盘,键值对应关系问题,和ASCII表对应符不符?请教!