/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
//***********************************************************************************************************
#include "ML51.h"
void main (void)
{
/* GPIO initial setting
* include gpio.c in Library for GPIO mode setting
*/
unsigned int u16bgvalue;
MFP_P31_UART0_TXD;
P31_QUASI_MODE;
UART_Open(24000000,UART0_Timer3,115200);
ENABLE_UART0_PRINTF;
/* ADC initial setting
* include adc.c in Library for ADC setting.
*/
ADC_Open(ADC_SINGLE,VLDO);
while(1)
{
clr_ADCCON0_ADCF; /*Clear ADC flag before ADC start */
set_ADCCON0_ADCS; /* Each time ADC start trig signal*/
while((ADCCON0|CLR_BIT7)==CLR_BIT7); /* wait ADCF = 1 */
u16bgvalue = (ADCRH<<4)+ADCRL;
printf ("\n VLDO = 0x%X",u16bgvalue);
Timer2_Delay(24000000,128,300,1000);
}
}
|