comwarrior
- 16th March 2010, 22:03
18F4550
ok, i have 6 analogue inputs i want to continuously scan.
What i thought of doing was to 'manually' kick off ADC's and using a DT interrupt to grab the result and set the next one...
That way the CPU can be doing math with the 'previous' values and displaying info on an LCD and scanning a keypad.
I'm just a little confused by the manuals explanation
The following steps should be followed to perform an
A/D conversion:
1. Configure the A/D module:
Configure analog pins, voltage reference and digital I/O (ADCON1)
Select A/D input channel (ADCON0)
Select A/D acquisition time (ADCON2)
Select A/D conversion clock (ADCON2)
Turn on A/D module (ADCON0)
2. Configure A/D interrupt (if desired):
Clear ADIF bit
Set ADIE bit
Set GIE bit
3. Wait the required acquisition time (if required).
4. Start conversion:
Set GO/DONE bit (ADCON0 register)
step 3, wait of the acquisition... i don't get what I'm supposed to wait for and why? and yes i read the section for AD conversion, twice at-least...
Last time i manually wrote a program to set-up, start and collect results from an ADC was with a Z80... [shakes head] 'it hurts, make it stop!' :eek:
Any help appreciated...
ok, i have 6 analogue inputs i want to continuously scan.
What i thought of doing was to 'manually' kick off ADC's and using a DT interrupt to grab the result and set the next one...
That way the CPU can be doing math with the 'previous' values and displaying info on an LCD and scanning a keypad.
I'm just a little confused by the manuals explanation
The following steps should be followed to perform an
A/D conversion:
1. Configure the A/D module:
Configure analog pins, voltage reference and digital I/O (ADCON1)
Select A/D input channel (ADCON0)
Select A/D acquisition time (ADCON2)
Select A/D conversion clock (ADCON2)
Turn on A/D module (ADCON0)
2. Configure A/D interrupt (if desired):
Clear ADIF bit
Set ADIE bit
Set GIE bit
3. Wait the required acquisition time (if required).
4. Start conversion:
Set GO/DONE bit (ADCON0 register)
step 3, wait of the acquisition... i don't get what I'm supposed to wait for and why? and yes i read the section for AD conversion, twice at-least...
Last time i manually wrote a program to set-up, start and collect results from an ADC was with a Z80... [shakes head] 'it hurts, make it stop!' :eek:
Any help appreciated...