Here's the little project I've been working on lately. This is my first 18F project, a pressure sensitive (strain gage) based DDR dancepad (basically a gamepad), with USB, Xbox (crippled USB), and PS2 interfaces. Mainly, I've modified Bradley A. Minch's driver, and made it pure asm code (no structured macros, which were upsetting gpasm). http://www.marcansoft.com/subidos/sdgp.zip The project is unfinished, but I figured I'd release it since the USB stuff is mostly done and working. The whole bundle consists of: - config.inc: some configuration #defines, only some USB stuff for now - hd44780.[asm|inc]: driver for a character LCM based around the hd44780 module. Fairly simple. - messages.inc: messages to show on the LCD screen. Also includes an interpreter for them (prints stuff out in different ways according to commands embedded withing the actual messages. Allows for vertical scrolls, defining custom CGRAM characters, etc. Might be of use for some). - stddefs.[asm|inc]: a set of definitions for common code. Contains ISR handler (saves/restores context and calls actual handlers), vectors, and a set of registers defined in the access bank for common usage. - usb.[asm|inc]: the bulk of the usb driver. Mainly the same as Minch's code, but with plain asm. I also used some slightly different names for registers (the ones Microchip uses in the datasheets), and changed some things here and there. - usbdefs.inc: defines for constants and registers for USB - usbdesc.inc: USB descriptors and the code to read them - utils.[asm|inc]: some utility functions. Some from piclist.com, others mine, others from Microchip datasheets, etc. Mostly straightforward stuff. If you use this, regenerate the delay stuff for your own clockspeed. I'm not even sure if they are accurate, since sometimes I just hacked the constants to save time. Will be cleaned up once the code gets close to complete. - sgdp.pikprj: the project file for pikdev, in case anyone here uses that. Things that do work: - USB HID mode. At least input reports work. Haven't tested output. The code passes the USBCV tests, although it does ignore a couple USB requirements (specifically, I am currently ignoring any current draw considerations right now, and the frequency of input reports is fixed and does not follow the spec closely. Will be fixed eventually. Probably many other details are not accurate too.) - The LCD driver, and message code. - interrupts, etc - pretty much what I do in the main code and utils, namely EEPROM handling, reading A/D, PWM, etc. Things that do not work: - Xbox mode. The Xbox uses basically a crippled usb HID mode, with no report descriptor and nonstandard class/subclass. This works with Xbox pad drivers on the PC, but the Xbox doesn't like my device. Maybe it requires some extra vendor request, or maybe it doesn't like my USB hub (Xbox pads have an internal hub and AFAIK the Xbox requires that the actual pad device be on port 0 of it. Interestingly, it does work on the Xbox while on the mod-chip menu, which I presume uses a different driver.) - PSX/PS2 interface. Not implemented yet. I basically use SPI slave mode which is very similar to the PS2 SIO bus, plus some extra control signals. I've gotten it working on a 16F876, so it should be fairly easy to get working here. The code is a work-in-progress. It has some hacks etc right now (I've had my share of oddities with interrupts, etc.). Keep in mind though that I'm not a PIC expert, so some things may be utterly wrong or just plain not the proper way of doing things. Constructive criticism is of course appreciated. Bradley A. Minch's original USB code can be found at: http://pe.ece.olin.edu/ece/projects.html -- Hector Martin (hector@marcansoft.com) Public Key: http://www.marcansoft.com/hector.asc -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist