v-usb on atmega32(help me)

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
newbie7

v-usb on atmega32(help me)

Post by newbie7 » Fri Feb 01, 2013 12:33 pm

pcb login : http://img843.imageshack.us/img843/8451/47320332.gif



hi everyone~

im working to make keyboard from V-USB.
but that has few problem.

check up plz.


<main.c> my code :
this code is can't input

PORTA = 0xFF; /* Port A = J4 pins 1-8 - enable pull-up */
DDRA = 0x00; /* Port A is input */
PORTB = 0xFF; /* Port B = J3 pins 1-8 - enable pull-up */
DDRB = 0x00; /* Port B is input */
PORTC = 0xFF; /* Port C = J4 pins 9-16 - enable pull-up */
DDRC = 0x00; /* Port C is input */
PORTD = 0xF8; /* 1111 1000 bin: LED on PD3,4,5 ROW17,18 on PD6,7 */
DDRD = 0x07; /* 0000 0101 bin: these pins are for USB output */
/* USB Reset by device only required on Watchdog Reset */
_delay_us(11); /* delay >10ms for USB reset */
DDRD = 0xF8;
TCCR0 = 5; /* timer 0 prescaler: 1024 */

....................

switch (row) {
case 0x0:
// Port C to weak pullups
DDRC = 0x00;
PORTC = 0xFF;
case 0x1 ... 0x7:
// Scan on A
DDRA = data;
PORTA = ~data;
break;
case 0x8:
// Port A to weak pullups
DDRA = 0x00;
PORTA = 0xFF;
case 0x9 ... 0xF:
// Scan on C
DDRC = data;
PORTC = ~data;
break;

case 0x10 ... 0x12:
// Scan on D
DDRD = data;
PORTD = ~data;
break;
}

data = PINB;


<main.c> my code :
this code can input

PORTA = 0xFF; /* Port A = J4 pins 1-8 - enable pull-up */
DDRA = 0x00; /* Port A is input */
PORTB = 0xFF; /* Port B = J3 pins 1-8 - enable pull-up */
DDRB = 0x00; /* Port B is input */
PORTC = 0xFF; /* Port C = J4 pins 9-16 - enable pull-up */
DDRC = 0x00; /* Port C is input */
PORTD = 0xF8; /* 1111 1000 bin: LED on PD3,4,5 ROW17,18 on PD6,7 */
DDRD = 0x07; /* 0000 0101 bin: these pins are for USB output */
/* USB Reset by device only required on Watchdog Reset */
_delay_us(11); /* delay >10ms for USB reset */
DDRD = 0xF8;
TCCR0 = 5; /* timer 0 prescaler: 1024 */

.................

switch (row) {
case 0x0:
// Port C to weak pullups
DDRC = 0x00;
PORTC = 0xFF;
case 0x1 ... 0x7:
// Scan on A
DDRB = data;
PORTB = ~data;
data = PINA;
break;
case 0x8:
// Port A to weak pullups
DDRA = 0x00;
PORTA = 0xFF;
case 0x9 ... 0xF:
// Scan on C
DDRB = data;
PORTB = ~data;
data = PINC;
break;
}



i think first code is right on pcb
but first code is can't input.

help me plz.

newbie7

Re: v-usb on atmega32(help me)

Post by newbie7 » Sat Feb 02, 2013 12:28 am

I solved a problem.

Post Reply