Update ES/Lab/Lab10/ADC.c
This commit is contained in:
parent
7b53dd846e
commit
5c23296007
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include <LPC17xx.h>
|
#include <LPC17xx.h>
|
||||||
|
|
||||||
|
unsigned long result, y; // global variable for ADC result
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
LPC_PINCON -> PINSEL3 = 3 << 28; // P1.30 function 3
|
LPC_PINCON -> PINSEL3 = 3 << 28; // P1.30 function 3
|
||||||
LPC_SC -> PCONP = 1 << 12; // power control
|
LPC_SC -> PCONP = 1 << 12; // power control
|
||||||
|
@ -15,6 +17,6 @@ int main(){
|
||||||
|
|
||||||
void ADC_IRQHandler(void)
|
void ADC_IRQHandler(void)
|
||||||
{
|
{
|
||||||
unsigned long Result;
|
result = (LPC_ADC -> ADGDR & (0xFFF << 4) >> 4 ); // Read 12-bit ADC result
|
||||||
Result = (LPC_ADC -> ADGDR & (0xFFF << 4)) >> 4 ; // Read 12-bit ADC result
|
y = (LPC_ADC -> ADDR4 & (0xFFF << 4) >> 4); // Done bit reset
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue