Für die TI Werkzeugkette muss eine Interrupt-Routine mit dem entsprechenden Schlüsselwort versehen sein:
- Code: Select all
- //---------------------------------------------------------------------
- interrupt void ADCINT1_ISR(void) // PIE1.1 @ 0x000D40 ADCINT1
- {
- static Uint16 *AdcBufPtr = AdcBuf; // Pointer to buffer
- static volatile Uint16 GPIO34_count = 0; // Counter for pin toggle
- PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
- //--- Manage the ADC registers
- AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Clear ADCINT1 flag
- //--- Read the ADC result
- *AdcBufPtr++ = AdcResult.ADCRESULT0; // Read the result
- //--- Brute-force the circular buffer
- if( AdcBufPtr == (AdcBuf + ADC_BUF_LEN) )
- {
- AdcBufPtr = AdcBuf; // Rewind the pointer to beginning
- }
- //--- Example: Toggle GPIO18 so we can read it with the ADC ***/
- if(DEBUG_TOGGLE == 1)
- {
- GpioDataRegs.GPATOGGLE.bit.GPIO18 = 1; // Toggle the pin
- }
- //--- Example: Toggle GPIO34 at a 0.5 sec rate (connected to the LED on the ControlCARD).
- // (1/50000 sec/sample)*(1 samples/int)*(x interrupts/toggle) = (0.5 sec/toggle)
- // ==> x = 25000
- if(GPIO34_count++ > 25000) // Toggle slowly to see the LED blink
- {
- GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // Toggle the pin
- GPIO34_count = 0; // Reset the counter
- }
- }
Kann man das aus Rhapsody z.B. über ein Sterotype für Methoden generieren lassen?