

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















void UserMain(void * pd) { InitializeStack(); if (EthernetIP==0)GetDHCPAddress(); OSChangePrio(MAIN_PRIO); EnableAutoUpdate(); DWORD isr_count=0; /* Count how many times the switch was hit / / Initialize the semaphore we are using / OSSemInit(&IrqPostSem,0); / First set up the Eport module to use IRQ1 as a falling-edge active IRQ pin (See the 5282 UM chapter 11). Set the pin assignment register irq1 pin falling edge sensitive. / sim.eport.eppar=0x0008; / 00 00 00 00 00 00 10 00 see table 11-3 in UM / sim.eport.epddr=0x0; / All edge port pins as inputs / sim.eport.epier = 0x0002; / Enable IRQ1 only 0 0 0 0 0 0 1 0 / / Now enable the actual interrupt controller. See users manual chapter 10 for more information. We are going to use the BSP helper function declared above and implemented in BSP.c / SetIntc(0, / The first interrupt controller / (long)&out_irq1_pin_isr, / Our interrupt function / 1, / The vector number from the users manual table 10-13 / 1, / Set this to priority 1 but any value from 1 to 6 would be valid./ 1 / The priority within the gross levels; see chapter 10, any value from 0 to 7 is ok / ); iprintf("Application started\n"); iprintf("Press the IRQ button on the development board.\n"); while (1) { OSSemPend(&IrqPostSem,0 / Wait forever */); PutDispDecimal(++isr_count,true); iprintf("The interrupt Switch was hit %ld times\r\n", isr_count); } } Docsity.com