#include #include "mcc_generated_files/mcc.h" #include "lcd_lib.h" unsigned char sBuf[16]; unsigned char rBuf[16]; char Flag, mFlag; int Index, Val, LedCol, RedC, BluC, GrnC; void main(void){ SYSTEM_Initialize(); mFlag = 0; Flag = 0; Index = 0; INTERRUPT_GlobalInterruptEnable(); INTERRUPT_PeripheralInterruptEnable(); Lcd_init(); LED_A2_SetHigh(); puts("Hellow"); while (1){ Val = ADC_GetConversion(ANA5); if(mFlag){ LED_A2_Toggle(); mFlag = 1; sprintf(sBuf,"AD=%4d\n\r", Val); Lcd_cmd(Lcd_L2); Lcd_str(sBuf); printf("%s",sBuf); } if(Flag){ Flag = 0; Lcd_clear(); Lcd_str(rBuf); printf("%s",rBuf); LedCol = atoi(rBuf[0]); RedC = LedCol % 2; GrnC = (LedCol / 2) % 2; BluC = (LedCol / 4) % 2; if(RedC){ RED_4_SetHigh(); }else{ RED_4_SetLow(); } if(GrnC){ GRN_8_SetHigh(); }else{ GRN_8_SetLow(); } if(BluC){ BLU_7_SetHigh(); }else{ BLU_7_SetLow(); } } } }