final code for the adc is now: joystick_report.x= (read_adc(4))/4-128;
all is now properly working .
thx for the help.
Search found 5 matches
- Wed Jun 12, 2013 11:04 pm
- Forum: V-USB
- Topic: multiple ADC channels
- Replies: 8
- Views: 8609
- Wed Jun 12, 2013 9:58 pm
- Forum: V-USB
- Topic: multiple ADC channels
- Replies: 8
- Views: 8609
Re: multiple ADC channels
i have put back the typedef struct, and used joystick_report.x and now it works, but in windows the axis goed to 127 and then jumps to -127 and it does this a few times before it centers on 0.
- Wed Jun 12, 2013 9:18 pm
- Forum: V-USB
- Topic: multiple ADC channels
- Replies: 8
- Views: 8609
Re: multiple ADC channels
if i take wdt_reset(); out of the main loop the device wil reset itself every second. its there in case the code stops working, and then the device wil restart/reconnect itself.
- Wed Jun 12, 2013 8:40 pm
- Forum: V-USB
- Topic: multiple ADC channels
- Replies: 8
- Views: 8609
Re: multiple ADC channels
here is how I do it. //voltage reader. #define ADC_VREF_TYPE 0x40 static int read_adc(unsigned char adc_input) { ADMUX=adc_input|ADC_VREF_TYPE; _delay_us(150); ADCSRA|=0x40; // Start the AD conversion while ((ADCSRA & 0x10)==0);// Wait for complete ADCSRA|=0x10; return ADCW; } reportBuffer[1]= ...
- Sat Jun 08, 2013 11:33 pm
- Forum: V-USB
- Topic: multiple ADC channels
- Replies: 8
- Views: 8609
multiple ADC channels
Hello, i am trying to make a USB-hid device with a atmega328p and i want to use multiple ADC channels. i have looked at the examples on the main site of objective develpment, but i still can't get it to work propperly. i have managed to get two channels to work but al other channels just have someki...