Line 1: Line 1:
 
[[Category:Starter PIC16F877]]
 
[[Category:Starter PIC16F877]]
 +
 +
=Code=
 +
<html>
 +
<script src="https://gist.github.com/sharanago/83a7537783383c8130576a79a493c87a.js"></script>
 +
</html>
  
 
[[File:Pic16f877aADC01.PNG]]<br><br>
 
[[File:Pic16f877aADC01.PNG]]<br><br>

Revision as of 17:13, 28 April 2016


Code

#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);
}

Pic16f877aADC01.PNG