原帖由 propeller 于 2006-6-16 00:47 发表
30us应该是很小的跳动。
看看输入信号的斜率
看看是不是有不该发生的中断套嵌
看看同步脉冲宽度判断用的宽度是不是小于发射机编码同步宽度的最小值。我用3ms
另外你不会是用的a++;做的宽度检测吧? ...
借了个示波器,准备周末再调试一下,或者干脆改变通道检测方式,16c745的ccp和portb管脚中断两种方式还没试验过。
我现在用3810玩aerofly,油门有3小格的随机抖动,玩模拟器没有问题,根本看不出来。但是问题就是问题,完全搞定了才有成就感:em15:。
const char ReportDescriptor1 [] =
{0x05, 0x01, /* usage page create @ 2006 05 29 by hzh */
0x09, 0x04, /* usage joystick */
0xa1, 0x01, /* collection (application) */
0x09, 0x30, /* USAGE (X) */
0x09, 0x31, /* USAGE (Y) */
0x09, 0x32, /* USAGE (Z) */
0x09, 0x33, /* USAGE (Rx) */
0x09, 0x34, /* USAGE (Ry) */
0x09, 0x35, /* USAGE (Rz) */
0x09, 0x36, /* USAGE (Slider) */
0x15, 0x00, /* LOGICAL_MINIMUM (0)*/
0x26, 0xff, /* LOGICAL_MAXIMUM (255) */
0x00, 0x75, /* REPORT_SIZE (8) */
0x08, 0x95, /* REPORT_COUNT (7) */
0x07, 0x81, /* INPUT (Data,Var,Abs) */
0x02, 0x05, /* USAGE_PAGE (Button) */
0x09, 0x19, /* USAGE_MINIMUM (Button 1) */
0x01, 0x29, /* USAGE_MAXIMUM (Button 8)*/
0x08, 0x15, /* LOGICAL_MINIMUM (0)*/
0x00, 0x25,
0x01, 0x75, /* LOGICAL_MAXIMUM (1)*/
0x01, 0x95, /* REPORT_SIZE (1) */
0x08, 0x81, /* REPORT_COUNT (8) */
0x02, 0xc0 /*END_COLLECTION*/
}; /* end collection */
const unsigned int ReportDescrSize = sizeof(ReportDescriptor1);
const char DeviceDescriptor [] = {0x12, DEVICE, 0, 1, 0, 0, 0, 8, 0xD8, 4 ,3, 0, 0, 0, 1, 2, 0, 1};
const char ConfigDescriptor [] = {9, CONFIGURATION, 0x22, 0, 1, 1, 4, 0x80, 0x32,
/* Interface Descriptor */ 9, INTERFACE, 0, 0, 1, 3, 0, 0, 5,
/* HID descriptor */ 9, 0x21, 0, 1, 0, 1, 0x22, sizeof(ReportDescriptor1), sizeof(ReportDescriptor1)>>8,
/* Endpoint 1 descriptor */ 7, ENDPOINT, 0x81, 3, 8, 0, 0x0a}; /* 8 = length, changed by hzh */
const char HIDDescriptor [] = {9, 0x21, 0, 1, 0, 1, 0x22, sizeof(ReportDescriptor1), sizeof(ReportDescriptor1)>>8};
MICROCHIP的 USB C语言代码:http://ww1.microchip.com/downloads/cn/DeviceDoc/cn_usb122c.zip
[ 本帖最后由 小刀 于 2006-6-16 09:35 编辑 ] |