Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * io_definitions.c
- *
- * Created on: Jun 19, 2013
- * Author: abdullah
- */
- #include "init.h"
- void initialize_CPU(void)
- {
- /* Disable Watchdog
- * Enable its Interrupt
- * Allow Updates
- * 0x60 : 0110 0000
- */
- WDOG_CS1 = 0x60;
- WDOG_CS2 = 1;
- WDOG_TOVAL = 0xFFFF;
- _ICS_C1.MergedBits.grpCLKS = 0; // 2 bits.
- _ICS_C2.MergedBits.grpBDIV = 0; // 3 bits.
- _ICS_C3.Bits.SCTRIM0 = 0; // SCTRIM
- }
- void initialize_IO(void)
- {
- touch_LED = 1;
- touch_LED_OE = 1;
- touch_LED_IE = ~touch_LED_OE;
- LED_ctrl = 0;
- LED_ctrl_OE = 1;
- LED_ctrl_IE = ~LED_ctrl_OE;
- LED_ctrl_HDRVE = 1;
- LED1 = 1;
- LED1_OE = 1;
- LED1_IE = ~LED1_OE;
- LED2 = 1;
- LED2_OE = 1;
- LED2_IE = ~LED2_OE;
- LED3 = 1;
- LED3_OE = 1;
- LED3_IE = ~LED3_OE;
- LED4 = 1;
- LED4_OE = 1;
- LED4_IE = ~LED4_OE;
- LED5 = 1;
- LED5_OE = 1;
- LED5_IE = ~LED5_OE;
- LED6 = 1;
- LED6_OE = 1;
- LED6_IE = ~LED6_OE;
- LED7 = 1;
- LED7_OE = 1;
- LED7_IE = ~LED7_OE;
- LED8 = 1;
- LED8_OE = 1;
- LED8_IE = ~LED8_OE;
- }
- void initialize_MTIM0(void)
- {
- _MTIM0_CLK.MergedBits.grpCLKS = 0; // 2 bits.
- _MTIM0_CLK.MergedBits.grpPS = 0; // 4 bits.
- MTIM0_overflow = 0;
- _MTIM0_SC.Bits.TOIE = 1; // Overflow interrupt enable.
- MTIM0_stop = 0;
- }
- void show_SRS(void)
- {
- volatile unsigned int counter = 0;
- unsigned char dummy = 0;
- extern _LED_register LED_register;
- LED_ctrl = 1;
- LED5 = 0;
- counter = 0xFFFF;
- while (counter > 0)
- {
- counter--;
- __RESET_WATCHDOG();
- }
- LED_ctrl = 0;
- LED5 = 1;
- counter = 0xFFFF;
- while (counter > 0)
- {
- counter--;
- __RESET_WATCHDOG();
- }
- LED_ctrl = 1;
- LED_register.LEDs = SYS_SRS;
- updateLEDs();
- dummy = 0x05;
- while (dummy > 0)
- {
- counter = 0xFFFF;
- while (counter > 0)
- {
- counter--;
- __RESET_WATCHDOG();
- }
- dummy--;
- }
- LED_ctrl = 0;
- LED_register.LEDs = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement