CURRENT ISSUE
Contests
Feature Article
|
|
Issue #213 April 2008
Programmable Power
Build a Simple USB DAC
by Yoshiyasu Takefuji
Start | USB Communications | Firmware | MAX517 (DAC) Programming | Firmware, Software, & LIUSB | Host Device Driver Installation | Testing | Sources & PDF
Listing 1—This is part of a usbconfig.h file for hardware configuration where PortB, PB0 for D–, and PB2 for D+ are set.
/* usbconfig.h */ #define USB_CFG_IOPORT PORTB /* This is the port where the USB bus is connected. When you * configure it to "PORTB", the registers PORTB, PINB (=PORTB+2) * and DDRB (=PORTB+1) will be used. */ #define USB_CFG_DMINUS_BIT 0 /* This is the bit number in USB_CFG_IOPORT where the USB D- line * is connected. This MUST be bit 0. All other values will result * in a compile error! */ #define USB_CFG_DPLUS_BIT 2 /* This is the bit number in USB_CFG_IOPORT where the USB D+ line * is connected. This may be any bit in the port. Please note * that D+ must also be connected to interrupt pin INT0! */
|