void BSP_InitIO (void) { #ifdef _TARGET_440H BSP_IO_Init(); LCD_Init(); Tmr_Init(); LED_Init(); /* Initialize LEDs */ LS2_UART_Init(); #else SYSTEMConfig(BSP_CLK_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); BSP_IO_Init(); #ifndef AX12_REG_PROGRAMMING // Initialize the board's I/Os Tmr_Init(); // Initialize the timers BSP_InitIntCtrl(); // Initialize the interrupt controller #endif LED_Init(); // Initialize LEDs //PB_Init(); // Initialize the push buttons ADC_Init(); PMP_Init(); LS2_UART_Init(); PWM_Init(); #endif }
/****** Initial ******************************************************** * * Initialize LCD Screen (PMP + configuration + initial display). * Initialize Timer5 for a loop time of 10 ms. **********************************************************************/ void Initial() { AD1PCFGL = 0xFFFF; // Make all ADC pins default to digital pins PMP_Init(); // Configure PMP module for LCD LCD_Init(); // Configure LCD controller InitBackground(); _TRISA3 = 0; // Make RA3 an output (pin 50 of Mikro board) TMR5 = 0; // Clear Timer5 PR5 = 19999; // Set period of Timer5 to 10 ms T5CON = 0x8010; // Clock Timer5 with Fcy/8 = 2 MHz _TRISD0 = 0; _CN2PUE = 1; _CN4PUE = 1; _CN5PUE = 1; //color box center locations white_x = 48+25; lr_x = white_x+51; lg_x = lr_x+51; lb_x = lg_x+51; yellow_x = lb_x+51; DrawRectangle(white_x-14, box_y-14, white_x+15, box_y+15, BLACK); DrawRectangle(white_x-12, box_y-12, white_x+13, box_y+13, WHITE); DrawRectangle(lr_x-14, box_y-14, lr_x+15, box_y+15, BLACK); DrawRectangle(lr_x-12, box_y-12, lr_x+13, box_y+13, LIGHT_RED); DrawRectangle(lg_x-14, box_y-14, lg_x+15, box_y+15, BLACK); DrawRectangle(lg_x-12, box_y-12, lg_x+13, box_y+13, LIGHT_GREEN); DrawRectangle(lb_x-14, box_y-14, lb_x+15, box_y+15, BLACK); DrawRectangle(lb_x-12, box_y-12, lb_x+13, box_y+13, LIGHT_BLUE); DrawRectangle(yellow_x-14, box_y-14, yellow_x+15, box_y+15, BLACK); DrawRectangle(yellow_x-12, box_y-12, yellow_x+13, box_y+13, YELLOW); Display(BKGD, (char *) HandleStr); DrawRectangle(currentBar_x, bargraph_top, currentBar_x+3, bargraph_bottom, WHITE); InitRPG(); }