技术热线: 4007-888-234

CCSC adc.c程序操作MCD2demo PIC16F877片内ADC

更新时间: 2019-03-25
阅读量:686

CCSC adc.c程序操作MCD2demo PIC16F877片内ADC
/*=============================================================================
使用PIC16F877A片内ADC,运行程序,LED0到LED7显示AD_IN电压
============================================================================
*////////////////////////////////////////////////////////////////////////////////// MPLAB IDE V7.11 + CCS C3.18// Use 16F877A ADC for MCD2-demo//// by
2005/06/23///////////////////////////////////////////////////////////////////////////////#include <16F877A.h>  
                          // PIC16F877 header file#device ADC=8                                  
// 8 bits ADC#use delay(clock=4000000)                      
// for 4Mhz crystal#fuses XT, NOWDT, NOPROTECT, NOLVP             
// for debug mode/
*===========================================================================
*/void main(void){        int8 adc_value;       
// init pic16f877a adc        setup_adc_ports(RA0_RA1_RA3_ANALOG);        setup_adc(ADC_CLOCK_INTERNAL);      
  set_adc_channel(0);        while(1){                adc_value = read_adc();                output_c(adc_value);                }   
     setup_adc(ADC_OFF);}
//end main()