void SYS_Initialize ( void* data ) { /* Set up cache and wait states for * maximum performance. */ SYSTEMConfigPerformance(80000000); /* Initialize the BSP */ BSP_Initialize( ); /* Initializethe interrupt system */ SYS_INT_Initialize(); /* set priority for NVM interrupt source */ SYS_INT_VectorPrioritySet(INT_VECTOR_FCE, INT_PRIORITY_LEVEL3); /* set sub-priority for NVM interrupt source */ SYS_INT_VectorSubprioritySet(INT_VECTOR_FCE, INT_SUBPRIORITY_LEVEL3); /* Initialize the global interrupts */ SYS_INT_Enable(); /* Initialize the NVM driver */ appDrvObjects.drvNVMObject = DRV_NVM_Initialize(DRV_NVM_INDEX_0, (SYS_MODULE_INIT *)&drvNVMInit); /* Initialize the Application */ APP_Initialize ( ); }
/**************************************************************************** Function: static void InitializeBoard(void) Description: This routine initializes the hardware. It is a generic initialization routine for many of the Microchip development boards, using definitions in HardwareProfile.h to determine specific initialization. Precondition: None Parameters: None - None Returns: None Remarks: None ***************************************************************************/ static void InitializeBoard(void) { // LEDs LED0_TRIS = 0; LED1_TRIS = 0; LED2_TRIS = 0; LED3_TRIS = 0; LED4_TRIS = 0; LED5_TRIS = 0; LED6_TRIS = 0; LED_PUT(0x00); // Enable multi-vectored interrupts //INTEnableSystemMultiVectoredInt(); // Enable optimal performance SYSTEMConfigPerformance(GetSystemClock()); mOSCSetPBDIV(OSC_PB_DIV_1); // Use 1:1 CPU Core:Peripheral clocks // Disable JTAG port so we get our I/O pins back, but first // wait 50ms so if you want to reprogram the part with // JTAG, you'll still have a tiny window before JTAG goes away DelayMs(50); DDPCONbits.JTAGEN = 0; LED_PUT(0x00); // Turn the LEDs off AD1PCFGbits.PCFG2 = 0; // Disable digital input on AN2 (potentiometer) // ADC AD1CON1 = 0x84E4; // Turn on, auto sample start, auto-convert, 12 bit mode (on parts with a 12bit A/D) AD1CON2 = 0x0404; // AVdd, AVss, int every 2 conversions, MUXA only, scan AD1CON3 = 0x1003; // 16 Tad auto-sample, Tad = 3*Tcy // PIC32MX460F512L PIM has different pinout to accomodate USB module AD1CSSL = 1<<2; // Scan pot }
int main() { SYSTEMConfigPerformance(10000000); //Configures low-level system parameters for 10 MHz clock enableInterrupts(); //This function is necessary to use interrupts. initLEDs(); initTimer1(); while(1){ switch(state) { case INIT: next_state = LED_0; break; case LED_0: turnOnLED(0); next_state = LED_1; break; case LED_1: turnOnLED(1); next_state = LED_2; break; case LED_2: turnOnLED(2); next_state = LED_0; break; } } return 0; }
void SYS_Initialize ( void * data ) { /* Configure the cache and flash wait * states for 80MHz. */ SYSTEMConfigPerformance(80000000); /* Initializethe interrupt system */ SYS_INT_Initialize(); /* Initialize the global interrupts */ SYS_INT_Enable(); SYS_INT_VectorPrioritySet(INT_VECTOR_USB, INT_PRIORITY_LEVEL4); SYS_INT_VectorSubprioritySet(INT_VECTOR_USB, INT_SUBPRIORITY_LEVEL0); SYS_INT_VectorPrioritySet(INT_VECTOR_CT, INT_PRIORITY_LEVEL3); SYS_INT_VectorSubprioritySet(INT_VECTOR_USB, INT_SUBPRIORITY_LEVEL0); BSP_Initialize(); /* Initialize the USB device layer */ deviceLayerObject = USB_DEVICE_Initialize (USB_DEVICE_INDEX_0 , ( SYS_MODULE_INIT* ) & usbDevInitData); /* check if the object returned by the device layer is valid */ SYS_ASSERT((SYS_MODULE_OBJ_INVALID != deviceLayerObject), "Invalid USB DEVICE object"); /* Initialize the Application */ APP_Initialize ( ); }
int main() { SYSTEMConfigPerformance(10000000); //Configures low-level system parameters for 10 MHz clock enableInterrupts(); //This function is necessary to use interrupts. //TODO: Write each initialization function initLEDs(); initTimer1(); while(1) { switch(state) { case led1: LATDbits.LATD0 = ON; LATDbits.LATD1 = OFF; LATDbits.LATD2 = OFF; break; case led2: LATDbits.LATD0 = OFF; LATDbits.LATD1 = ON; LATDbits.LATD2 = OFF; break; case led3: LATDbits.LATD0 = OFF; LATDbits.LATD1 = OFF; LATDbits.LATD2 = ON; break; } } return 0; }
int main(void) { SYSTEMConfigPerformance(10000000); initTimer1(); initSW2(); initLEDs(); enableInterrupts(); state = led1; while(1) { //TODO: Using a finite-state machine, define the behavior of the LEDs //Debounce the switch switch(state) { case led1: turnOnLED(1); stateNext = led2; break; case led2: turnOnLED(2); stateNext = led1; break; case deBounce1: delayUs(10000); break; case deBounce2: delayUs(10000); break; } } return 0; }
int main(void) { // Initialize LED, sound and the program button pins. maximite_init(); // Initial setup of the I/O ports. AD1PCFG = 0xFFFF; // Default all pins to digital. mJTAGPortEnable(0); // Turn off JTAG. // Setup the CPU. // System config performance. SYSTEMConfigPerformance(CLOCKFREQ); // Fix the peripheral bus to the main clock speed. mOSCSetPBDIV(OSC_PB_DIV_1); INTEnableSystemMultiVectoredInt(); // Allow vectored interrupts. usb_init(); keyboard_init(); // Initialise and startup the keyboard routines. rk86_video_init(); // Start the video state machine. delay_us(1000); while (keyboard_inkey() != -1); i8080_pic32_run(); panic(PANIC_EMULATION_TERMINATED); return 0; }
// *--------------------------------------------------------------------------------* int main(){ mJTAGPortEnable(0); // JTAG des-habilitado SYSTEMConfigPerformance(GetSystemClock()); // Activa pre-cache.- AD1PCFG = 0xFFFF; LED1_OUTPUT(); LED2_OUTPUT(); SW1_INPUT(); SW2_INPUT(); buttonCount = 0; buttonPressed = FALSE; stringPrinted = TRUE; USBDeviceInit(); while(1){ #if defined(USB_INTERRUPT) if(USB_BUS_SENSE && (USBGetDeviceState() == DETACHED_STATE)){ USBDeviceAttach(); } #endif #if defined(USB_POLLING) // Check bus status and service USB interrupts. USBDeviceTasks(); #endif ProcessIO(); } }
void hal_sys_init(){ SYSTEMConfigPerformance(SYS_CLK); INTSetVectorPriority(INT_VECTOR_UART(UART3),3); INTSetVectorPriority(INT_VECTOR_UART(UART5), 3); INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); INTDisableInterrupts(); }
int main(void) { char buffer[80]; unsigned int pb_clock; float actual_baud; const int baud = 500000; // max baud rate using arduino interface pb_clock = SYSTEMConfigPerformance(SYS_CLK); // if sys_clock > 100MHz, pb_clock = sys_clock/2 else pb_clock = sys_clock PORTSetPinsDigitalOut(IOPORT_E, BIT_4); // led // setup UART PPSUnLock; PPSInput(1,U1RX,RPF4); // Rx - F4 (pin 49) 5V tolerent PPSOutput(2,RPF5,U1TX); // Tx - F5 (pin 50) 5V tolerent PPSLock; actual_baud = U1_init(pb_clock, baud); sprintf(buffer, "SYSCLK: %d\r\n", SYS_CLK); U1_write(buffer); sprintf(buffer, "PBCLK: %d\r\n", pb_clock); U1_write(buffer); sprintf(buffer, "U1BRG: %d\r\n", U1BRG); U1_write(buffer); sprintf(buffer, "target baud: %d\r\n", baud); U1_write(buffer); sprintf(buffer, "actual baud: %f\r\n", actual_baud); U1_write(buffer); timer1_init(); timer_delay_test(); }
//************************************************************************ void init() { #ifdef _ENABLE_PIC_RTC_ // Configure the device for maximum performance but do not change the PBDIV // Given the options, this function will change the flash wait states, RAM // wait state and enable prefetch cache but will not change the PBDIV. // The PBDIV value is already set via the pragma FPBDIV option above.. __PIC32_pbClk = SYSTEMConfig(F_CPU, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); #else __PIC32_pbClk = SYSTEMConfigPerformance(F_CPU); #endif OpenCoreTimer(CORE_TICK_RATE); // set up the core timer interrupt with a prioirty of 2 and zero sub-priority mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0)); // enable multi-vector interrupts INTEnableSystemMultiVectoredInt(); #ifdef _ENABLE_PIC_RTC_ RtccInit(); // init the RTCC // while(RtccGetClkStat() != RTCC_CLK_ON); // wait for the SOSC to be actually running and RTCC to have its clock source // could wait here at most 32ms delay(50); // time is MSb: hour, min, sec, rsvd. date is MSb: year, mon, mday, wday. RtccOpen(0x10073000, 0x11010901, 0); RtccSetTimeDate(0x10073000, 0x10101701); // please note that the rsvd field has to be 0 in the time field! #endif //* as per [email protected], Jan 7, 2011 //* Disable the JTAG interface. DDPCONbits.JTAGEN = 0; #if defined (_BOARD_MEGA_) //* Turn Secondary oscillator off //* this is only needed on the mega board because the mega uses secondary ocsilator pins //* as general I/O { unsigned int dma_status; unsigned int int_status; mSYSTEMUnlock(int_status, dma_status); OSCCONCLR = _OSCCON_SOSCEN_MASK; mSYSTEMLock(int_status, dma_status); } #endif }
int main(void) { SYSTEMConfigPerformance(40000000); initKeypad(); enableEnterruptKeypad(); initTimer2(); initLCD(); enableInterrupts(); moveCursorLCD(0,0); state = Wait; while (1) { switch (state) { case Wait: break; case Scan: key = scanKeypad(); state = MoveCursor; break; case MoveCursor: if(count == 0) moveCursorLCD(0,0); else if (count == 9) moveCursorLCD(1,0); state = Print; break; case debounce1: delayUs(500); state = Scan; break; case debounce2: delayUs(500); state = MoveCursor; break; case Print: delayUs(100); if(key == 0) printCharLCD('0'); else if(key == 1) printCharLCD('1'); else if(key == 2) printCharLCD('2'); else if(key == 3) printCharLCD('3'); else if(key == 4) printCharLCD('4'); else if(key == 5) printCharLCD('5'); else if(key == 6) printCharLCD('6'); else if(key == 7) printCharLCD('7'); else if(key == 8) printCharLCD('8'); else if(key == 9) printCharLCD('9'); else if(key == 10) printCharLCD('*'); else if(key == 11) printCharLCD('#'); state = Wait; break; } } return 0; }
int main(void) { //Initialize new interrupt fix SYSTEMConfigPerformance(40000000); #ifdef part1 initSW(); initLED(RUN_LED); initLED(STOP_LED); initTimer2(); enableInterrupts(); // initialize the lights state = runToggle; turnOffLED(STOP_LED); turnOnLED(RUN_LED); while(1){ switch(state){ // the state that toggles the LEDs case runToggle: // switch the led's toggleAllLEDs(); prevState = runToggle; state = waitForPress; //Go to debounce press state break; // wait for user input i.e. button press case waitForPress: while (state == waitForPress); break; // once the button has been pressed case dbPress: delayUs(DBdelayTime); // Delay for 5ms while(state == dbPress ); break; // once the button has been released case dbRelease: delayUs(DBdelayTime); //Delay for 5ms state = runToggle; break; } } #endif return 0; }
int main(void) { SYSTEMConfigPerformance(SYS_FREQ); lcd_init(); while(1); return 0; }
void Initialize() { int pbClk = SYSTEMConfigPerformance(SYS_FREQ); InitializeIO(); //set up IO (directions and functions) initUART1(pbClk); SpiInitDevice(1, 1, 0, 0); nrf24l01_initialize_debug(true, width, false); //initialize the 24L01 to the debug configuration as RX, 1 data byte, and auto-ack disabled }
void systemInit(void) { //Enable optimal performance SYSTEMConfigPerformance(80000000); //Configures peripheral bus divisor OSCSetPBDIV(OSC_PB_DIV_2); //Enable multi-vectored mode INTEnableSystemMultiVectoredInt(); }
static void InitializeSystem(void) { AD1PCFG = 0xFFFF; SYSTEMConfigPerformance(80000000); UserInit(); USBDeviceInit(); // Initializes USB module SFRs and firmware // variables to known states. ConfigINT0(EXT_INT_PRI_6 | RISING_EDGE_INT | EXT_INT_ENABLE); mPMPOpen(PMP_CONTROL, PMP_MODE, PMP_PORT, PMP_INT); PMPSetAddress(0x4000); }
// initialize hardware void Initialize() { // All of these items will affect the performance of your code and cause it to run significantly slower than you would expect. SYSTEMConfigPerformance(SYS_CLOCK); WriteCoreTimer(0); // Core timer ticks once every two clocks (verified) // set default digital port A for IO DDPCONbits.JTAGEN = 0; // turn off JTAG DDPCONbits.TROEN = 0; // ensure no tracing on //mPORTASetPinsDigitalOut(BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7); // todo - set this based on width of image. make rest inputs? mPORTBSetPinsDigitalOut(BIT_0|BIT_1|BIT_2|BIT_3|BIT_4|BIT_5|BIT_6|BIT_7|BIT_8|BIT_9|BIT_10|BIT_11|BIT_12|BIT_13|BIT_14|BIT_15); // Configure the device for maximum performance but do not change the PBDIV // Given the options, this function will change the flash wait states, RAM // wait state and enable prefetch cache but will not change the PBDIV. // The PBDIV value is already set via the pragma FPBDIV option above.. int pbClk = SYSTEMConfig( SYS_CLOCK, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); InitializeUART(pbClk); mPORTASetPinsDigitalOut(BIT_1); // set internals // SetUARTClockDivider(flashOptions.baudDivisor); // prepare 32 bit timer 45 to trigger interrupts //OpenTimer45(T45_ON | T45_SOURCE_INT | T45_PS_1_1, interruptTime); // set up the timer interrupt and priority //ConfigIntTimer45(T4_INT_ON | T4_INT_PRIOR_7); // enable multivectored interrupts //INTEnableSystemMultiVectoredInt(); // start watchdog timer //tickle in interrupt, turn off during reset of device, causes a reset //The next statement enables the Watchdog Timer: // WDTCONbits.ON = 1; //sprintf(text,"Wait states %d\r\n.",BMXCONbits.BMXWSDRM); //PrintSerial(text); //BMXCONbits.BMXWSDRM = 0; // set RAM access to zero wait states //sprintf(text,"TODO _ REMOVE:override %d\r\n",pinOverride); //PrintSerial(text); //sprintf(text,"TODO _ REMOVE:actual %d\r\n",PORTAbits.RA1); //PrintSerial(text); }
int main(void) { SYSTEMConfigPerformance(10000000); initTimer2(); initLCD(); while(1) { testLCD(); } return 0; }
/*-----------------------------------------------------------*/ static void prvSetupHardware(void) { /* Setup the CPU clocks, and configure the interrupt controller. */ SYSTEMConfigPerformance(configCPU_CLOCK_HZ); mOSCSetPBDIV(OSC_PB_DIV_2); INTEnableSystemMultiVectoredInt(); /* LEDs off. */ mPORTDClearBits(BIT_0 | BIT_1 | BIT_2); /* LEDs are outputs. */ mPORTDSetPinsDigitalOut(BIT_0 | BIT_1 | BIT_2); }
static void prvSetupHardware( void ) { /* Set the system and peripheral bus speeds and enable the program cache*/ SYSTEMConfigPerformance( configCPU_CLOCK_HZ - 1 ); mOSCSetPBDIV( OSC_PB_DIV_2 ); /* Setup to use the external interrupt controller. */ INTEnableSystemMultiVectoredInt(); portDISABLE_INTERRUPTS(); /* Setup the digital IO for the LED's. */ vParTestInitialise(); }
int main(void) { SYSTEMConfigPerformance(40000000); enableInterrupts(); initTimer2(); //initLCD(); testLCD(); while(1) { //testLCD(); } return 0; }
/* * Initialize the board * Timers, Communication, etc * Note : Should only be called once at the begginning of the main */ void InitBoard(void) { // Initialize clock SYSTEMConfigPerformance(GetSystemClock()); SYSTEMConfig(GetSystemClock(), SYS_CFG_PCACHE); SYSTEMConfig(GetSystemClock(), SYS_CFG_PB_BUS); SYSTEMConfigPB(GetSystemClock()); INTEnableSystemMultiVectoredInt(); //Disable JTAG port DDPCONbits.JTAGEN = 0; // Initialize LEDs LED1_TRIS = 0; LED2_TRIS = 0; // Initialize Timers InitTimers(); // Initialize CAN bus CRX1_TRIS = 1; CTX1_TRIS = 0; netv_init_can_driver(GetBoardID(),CAN1); // Initialize digital IOs as inputs DIO_TRIS |= DIO_MASK; // Initialize Relays (low) RELAY1_TRIS = 0; RELAY2_TRIS = 0; RELAY1 = 0; RELAY2 = 0; // Initialize SPI pins as inputs SPICLK_TRIS = 1; SPISDO_TRIS = 1; SPI_CS_TRIS = 1; SPISDI_TRIS = 1; //TODO: Init unused pins as inputs // Read the board ID m_unBoardId = (DIO_PORT & DIO_MASK) ^ DIO_MASK; // Read the parameters previously saved in flash loadDataFromMemory(); //Enables the core to handle any pending interrupt requests asm volatile ("ei"); }
// *--------------------------------------------------------------------------------* int main(){ UINT16 Count=0; mJTAGPortEnable(0); // JTAG des-habilitado SYSTEMConfigPerformance(GetSystemClock()); // Activa pre-cache.- LED1_OUTPUT(); LED2_OUTPUT(); INTEnableSystemMultiVectoredInt(); deviceAttached = FALSE; //Initialize the stack USBInitialize(0); while(1){ //USB stack process function USBTasks(); if(++Count==0){ LED1_TOGGLE(); } //if thumbdrive is plugged in if(USBHostMSDSCSIMediaDetect()){ deviceAttached = TRUE; LED1_OFF(); //now a device is attached //See if the device is attached and in the right format if(FSInit()){ //Opening a file in mode "w" will create the file if it doesn't // exist. If the file does exist it will delete the old file // and create a new one that is blank. myFile = FSfopen("test.txt","w"); //Write some data to the new file. FSfwrite("This is a test.",1,15,myFile); //Always make sure to close the file so that the data gets // written to the drive. FSfclose(myFile); //Just sit here until the device is removed. while(deviceAttached == TRUE){ USBTasks(); if(++Count==0){ LED2_TOGGLE(); } } LED2_OFF(); } } } }
void SYS_Initialize ( void* data ) { /* Set up cache and wait states for * maximum performance. */ SYSTEMConfigPerformance(80000000); /* Initialize the BSP */ BSP_Initialize( ); /* Initialize MDD */ USB_DEVICE_MDD_INTFLASH_Initialize( 0, (const SYS_MODULE_INIT * const)&mddFlashInitData ); /* Initialize the USB device layer */ appDrvObject.usbDevObject = USB_DEVICE_Initialize (USB_DEVICE_INDEX_0 , ( SYS_MODULE_INIT* ) & usbDevInitData); /* check if the object returned by the device layer is valid */ SYS_ASSERT((SYS_MODULE_OBJ_INVALID != appDrvObject.usbDevObject), "Invalid USB DEVICE object"); /* open an instance of the device layer */ appData.usbDevHandle = USB_DEVICE_Open( USB_DEVICE_INDEX_0, 0 ); /* Register a callback with device layer to get event notification (for end point 0) */ USB_DEVICE_EventCallBackSet(appData.usbDevHandle, APP_USBDeviceEventHandler); /* Register a callback for acquiring vendor specific setup packet */ //USB_DEVICE_ControlEventCallBackSet(appData.usbDevHandle, APP_UsbDeviceControlEventCallBack ); USB_DEVICE_Attach(appData.usbDevHandle); /* Initialize the Application */ APP_Initialize ( ); /* Initializethe interrupt system */ SYS_INT_Initialize(); /* set priority for USB interrupt source */ SYS_INT_VectorPrioritySet(INT_VECTOR_USB, INT_PRIORITY_LEVEL3); /* set sub-priority for USB interrupt source */ SYS_INT_VectorSubprioritySet(INT_VECTOR_USB, INT_SUBPRIORITY_LEVEL3); /* Initialize the global interrupts */ SYS_INT_Enable(); }
// Initialize the serial port // Note: the NU32v2 is hard wired to use UART3 (= UART2A) void initSerialNU32v2() { int pbClk; // Configure the system performance pbClk = SYSTEMConfigPerformance(SYS_FREQ); UARTConfigure(UART3, UART_ENABLE_PINS_TX_RX_ONLY); UARTSetFifoMode(UART3, UART_INTERRUPT_ON_TX_DONE | UART_INTERRUPT_ON_RX_NOT_EMPTY); UARTSetLineControl(UART3, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1); UARTSetDataRate(UART3, pbClk, DESIRED_BAUDRATE_NU32); UARTEnable(UART3, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX)); // Configure UART3 RX Interrupt INTEnable(INT_U3RX, INT_ENABLED); INTSetVectorPriority(INT_UART_3_VECTOR, INT_PRIORITY_LEVEL_2); INTSetVectorSubPriority(INT_UART_3_VECTOR, INT_SUB_PRIORITY_LEVEL_0); }
int main() { SYSTEMConfigPerformance(10000000); //Configures low-level system parameters for 10 MHz clock enableInterrupts(); //This function is necessary to use interrupts. //TODO: Write each initialization function initLEDs(); initTimer1(); while(1){ //TODO: Implement a state machine to create the desired functionality } return 0; }
int main(void) { // Configure the device for maximum performance but do not change the PBDIV // Given the options, this function will change the flash wait states, RAM // wait state and enable prefetch cache but will not change the PBDIV. // The PBDIV value is already set via the pragma FPBDIV option above.. SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); // Auto-configure the PIC32 for optimum performance at the specified operating frequency. SYSTEMConfigPerformance(SYS_FREQ); // osc source, PLL multipler value, PLL postscaler , RC divisor OSCConfig(OSC_POSC_PLL, OSC_PLL_MULT_20, OSC_PLL_POST_1, OSC_FRC_POST_1); // Configure the PB bus to run at 1/4 the CPU frequency OSCSetPBDIV(OSC_PB_DIV_4); // Enable multi-vector interrupts INTEnableSystemMultiVectoredInt(); INTEnableInterrupts(); // Set up the UART peripheral so we can send serial data. UARTConfigure(UART_USED, UART_ENABLE_PINS_TX_RX_ONLY); UARTSetFifoMode(UART_USED, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY); UARTSetLineControl(UART_USED, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1); UARTSetDataRate(UART_USED, F_PB, UART_BAUD_RATE); UARTEnable(UART_USED, UART_ENABLE | UART_TX); // And configure printf/scanf to use the correct UART. if (UART_USED == UART1) { __XC_UART = 1; } /*************************************************************************************************** * Your code goes in between this comment and the following one with asterisks. **************************************************************************************************/ /*************************************************************************************************** * Your code goes in between this comment and the preceding one with asterisks. **************************************************************************************************/ // Returning from main() is bad form in embedded environments. So we sit and spin. while (1); }
int main() { static uint8_t arg; /* * Init CPU: include/peripheral/system.h */ SYSTEMConfigPerformance(FCY); /* Init I/O */ init_io(); /* Blink LED 10 times */ blink(10); /* Init ICSP I/O */ init_icspio(); /* ICSP I/O */ while (1) { switch (icspio_common()) { default:icspio_err = icspio_sendbyte(NAK); continue; case CMD_LED: icspio_err = icspio_sendbyte(ACK); if (icspio_err) continue; icspio_err = icspio_getbyte(&arg); if (icspio_err) continue; LATA = arg; WDTCONSET = 1; /* RESET Watchdog */ break; case CMD_SWITCH: icspio_err = icspio_sendbyte(ACK); if (icspio_err) continue; icspio_err = icspio_sendbyte(PORTB); if (icspio_err) continue; } icspio_err = icspio_sendbyte(icspio_checksum); } }
int main(void) { SYSTEMConfigPerformance(10000000); LCD_Init(); //LCD_Clear(); //int x = 0; //for(x = 0;x < 6 ;x++)LCD_OtherTest2(); //LCD_MoveCursor(1,2); //for(x = 0;x < 3 ;x++)LCD_OtherTest2(); while(1) { //LCD_OtherTest(); LCD_Test(); } return 0; }