Update ES/Lab/Lab10/ADC.c

This commit is contained in:
aadit 2025-10-16 12:00:37 +05:30
parent 7b53dd846e
commit 5c23296007

View file

@ -1,5 +1,7 @@
#include <LPC17xx.h>
unsigned long result, y; // global variable for ADC result
int main(){
LPC_PINCON -> PINSEL3 = 3 << 28; // P1.30 function 3
LPC_SC -> PCONP = 1 << 12; // power control
@ -15,6 +17,6 @@ int main(){
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
}