Difference between revisions of "PIC16F877A ADC on Starter Borad"
Line 9: | Line 9: | ||
=Demo= | =Demo= | ||
− | [[File: | + | [[File:Pic16f877aADC00.gif]]<br><br> |
Revision as of 18:36, 28 April 2016
Code
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
#include "adc.h" | |
#include "uart.h" | |
int main() | |
{ | |
int adcValue; | |
ADC_Init(); /* Initialize the ADC module */ | |
UART_Init(9600); /* Initialize UART at 9600 baud rate */ | |
while(1) | |
{ | |
adcValue = ADC_GetAdcValue(0); // Read the ADC value of channel zero | |
UART_Printf("ADC0 Value:%4d \n\r",adcValue); // Send the value on UART | |
} | |
return (0); | |
} |