Winch
Member
Hi,
Never worked with an ATmega32U4 before, until now worked with PIC processors!
Try to start the ADC but it seems to be different from a PIC? What is wrong with the bottom code?
The LCD display shows the maximum information from the ADC. (1023)
A potentiometer is connected to the input, but the ADC input does not respond to this.
When I use such a code with a PIC it doesn't cause any problems.
Never worked with an ATmega32U4 before, until now worked with PIC processors!
Try to start the ADC but it seems to be different from a PIC? What is wrong with the bottom code?
The LCD display shows the maximum information from the ADC. (1023)
A potentiometer is connected to the input, but the ADC input does not respond to this.
When I use such a code with a PIC it doesn't cause any problems.
Code:
'device ATmega32u4
Define CLOCK_FREQUENCY = 16
Define LCD_BITS = 4
Define LCD_DREG = PORTB
Define LCD_DBIT = 4
Define LCD_RSREG = PORTD
Define LCD_RSBIT = 4
Define LCD_EREG = PORTD
Define LCD_EBIT = 7
Define LCD_RWREG = PORTD
Define LCD_RWBIT = 0
Define ADC_CLOCK = 3
Define ADC_VREF = 0
Define ADC_SAMPLEUS = 20
ConfigPin PORTF.5 = Input
Dim pot As Word
Lcdinit 0
WaitMs 500
pot = 0
main:
Adcin 5, pot
Lcdcmdout LcdLine1Home
Lcdout "Potentiometer"
Lcdcmdout LcdLine2Home
Lcdout #pot
WaitMs 100
Goto main
End