Created
September 14, 2016 01:07
-
-
Save danibyay/b975eae46ab6172d80c3aba61820c3a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Program to use the ADC Module of the Freescale microcontroler S08QG8 | |
Using 3 channels (GPIO) | |
*/ | |
unsigned char ADC_value[3]; | |
unsigned char ADC_sel[] = {0x60, 0x63, 0x66}; | |
unsigned char i; | |
interrupt VectorNumber_Vadc void ADC_ISR (void) | |
{ | |
ADCSC1 = ADC_sel[i]; | |
ADC_value[i++] = ADCRL; | |
if( i == 3 ) | |
{ | |
i = 0; | |
} | |
} | |
void main ( void ) | |
{ | |
i = 0; | |
//activar 3 canales, 3 pines como entradas analogicas | |
APCTL1_ADPC0 = 1; | |
APCTL1_ADPC3 = 1; | |
APTL1_ADPC6 = 1; | |
ADCSC1 = 0b01100000; //para leer del canal cero | |
do | |
{ | |
__RESET_WATCHDOG(); | |
}while (1) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment