本文整理汇总了C++中INTClearFlag函数的典型用法代码示例。如果您正苦于以下问题:C++ INTClearFlag函数的具体用法?C++ INTClearFlag怎么用?C++ INTClearFlag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INTClearFlag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: __ISR
// UART 2 interrupt handler
// it is set at priority level 2
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
unsigned char databyte;
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
databyte = UARTGetDataByte(UART2);
databyte++;
// Echo what we just received.
PutCharacter(databyte);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
}
}
开发者ID:gabrielbaca,项目名称:roboticsProject,代码行数:31,代码来源:main+-+PruebaIrACuarto2.c
示例2: __ISR
// UART 2 interrupt handler
// it is set at priority level 2
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
// Echo what we just received.
PutCharacter(UARTGetDataByte(UART2));
// Toggle LED to indicate UART activity
mPORTAToggleBits(BIT_7);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
}
}
开发者ID:gabrielbaca,项目名称:roboticsProject,代码行数:30,代码来源:main+-+motoresConDelays.c
示例3: FIFOUART1_initialize
//******************************************************************************
//Public Function Definitions
//******************************************************************************
void FIFOUART1_initialize()
{
UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | //Sets the data transfer size to 8-bits per frame.�
UART_PARITY_NONE | //Disables parity bit generation.�
UART_STOP_BITS_1); //1 stop bit per frame (default).�
UARTSetDataRate(UART1, GetPeripheralClock(), FIFOUART1_BAUD_RATE);
//Interrupt Stuff
INTSetVectorPriority(INT_UART_1_VECTOR, INT_PRIORITY_LEVEL_5);
INTSetVectorSubPriority(INT_UART_1_VECTOR, INT_SUB_PRIORITY_LEVEL_0);
INTClearFlag(INT_U1RX);
INTClearFlag(INT_U1TX);
//configure what triggers UART1 itnerrupts
UARTSetFifoMode(UART1,
UART_INTERRUPT_ON_TX_BUFFER_EMPTY | //TX interrupt will occur when the TX buffer is empty.�
UART_INTERRUPT_ON_RX_NOT_EMPTY); //RX interrupt will occur whenever the RX buffer has any data.�
//Enable UART1 Rx Interrupt
INTEnable(INT_U1RX, INT_ENABLED);
//Enable UART1 Tx Interrupt
//INTEnable(INT_U1TX, INT_ENABLED);
UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
}
开发者ID:NaanTeam,项目名称:PID_Controller.X,代码行数:35,代码来源:FIFOUART1.c
示例4: MyCyclone_Init
void MyCyclone_Init(void)
{
// Configure Reset Pin = GPIO_2[10] = RD7
mPORTDClearBits(RST_FPGA);
mPORTDSetPinsDigitalOut(RST_FPGA);
// Do a Reset
mPORTDSetBits(RST_FPGA);
mPORTDClearBits(RST_FPGA);
// Do Interrupts Initialization
// Set RD8/INT1 and RD9/INT2 as inputs
mPORTDSetPinsDigitalIn(BIT_8 | BIT_9);
// Clear corresponding bits in INTCON for falling edge trigger
INTCONCLR = _INTCON_INT1EP_MASK | _INTCON_INT2EP_MASK;
// Set up interrupt prioirty and sub-priority
INTSetVectorPriority(INT_EXTERNAL_1_VECTOR, My_INT_EXTERNAL_1_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_1_VECTOR, My_INT_EXTERNAL_1_SUB_PRIORITY);
INTSetVectorPriority(INT_EXTERNAL_2_VECTOR, My_INT_EXTERNAL_2_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_2_VECTOR, My_INT_EXTERNAL_2_SUB_PRIORITY);
// Clear the interrupt flags
INTClearFlag(INT_INT1);
INTClearFlag(INT_INT2);
// Enable INT1 & INT2
INTEnable(INT_INT1, INT_ENABLED);
INTEnable(INT_INT2, INT_ENABLED);
// Enable KEY0 and KEY1 interrupts and IOs of the MyExpansionBoard_IO_v2
MyCyclone_Write(CYCLONE_CONFIG,CYCLONE_ENABLE_INT_KEY0 | CYCLONE_ENABLE_INT_KEY1 | CYCLONE_ENABLE_IO_AB | CYCLONE_ENABLE_IO_CD);
}
开发者ID:lechienv,项目名称:ProgSandbot,代码行数:29,代码来源:MyCyclone.c
示例5: __ISR
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
COMMAND = UARTGetDataByte(UART2);
// Echo what we just received.
PutCharacter(COMMAND);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
//none
}
}
开发者ID:gabrielbaca,项目名称:roboticsProject,代码行数:26,代码来源:main+-+EsquivaPerroAvanzado.c
示例6: ConfigSPIComms
BOOL ConfigSPIComms(void)
{
SpiChnClose(RPI_SPI_CHANNEL);
/* do I need to configure this? */
INTEnable(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI_TX(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI_ERROR(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI(RPI_SPI_CHANNEL),INT_DISABLED);
SPI_DATA_IN_DIRECTION = TRIS_IN;
SPI_DATA_OUT_DIRECTION = TRIS_OUT;
SPI_CLOCK_IN_DIRECTION = TRIS_IN;
SPI_SELECT_IN_DIRECTION = TRIS_IN;
SPI.RXCount=0;
SPI.TXCount=0;
SPI.address=0;
SPI.command=TRISTHIS_SPI_NO_COMMAND;
SpiChnOpen(RPI_SPI_CHANNEL,
SPI_OPEN_SLVEN|SPI_OPEN_CKE_REV|SPI_OPEN_MODE8|SPI_OPEN_SSEN,
0);
//TODO: Not acting consistently? RPI needs to send -b 8 -H parameters to spidev
/* configure interrupts */
INTSetVectorPriority(INT_VECTOR_SPI(RPI_SPI_CHANNEL), INT_PRIORITY_LEVEL_3);
INTSetVectorSubPriority(INT_VECTOR_SPI(RPI_SPI_CHANNEL),
INT_SUB_PRIORITY_LEVEL_1);
INTClearFlag(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL));
INTEnable(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL),INT_ENABLED);
INTClearFlag(INT_SOURCE_SPI_TX(RPI_SPI_CHANNEL));
INTClearFlag(INT_SOURCE_SPI_ERROR(RPI_SPI_CHANNEL));
INTClearFlag(INT_SOURCE_SPI(RPI_SPI_CHANNEL));
//INTEnable(INT_SOURCE_SPI(RPI_SPI_CHANNEL),INT_ENABLED);
/* configure change notice, as I can't figure out any other way to */
/* trigger the beginning of the slave select with just the SPI peripheral */
/* buuut the change notice pins are not on the SS pins, so a white wire is*/
/* needed */
/* tie chip enable CE0 to pin20/RE5 CE1 */
SPI_SELECT_CN_DIRECTION=TRIS_IN;
CNCONbits.w=0;
CNCONSET=_CNCON_ON_MASK;
CNENbits.w=0;
CNENSET=_CNEN_CNEN7_MASK;
CNTemp=CE_PORT; /* read for change notice */
RPI_SPI_RX_OVERFLOW_CLEAR;
SPI1CONbits.STXISEL=0b01;
SPI.status.w=0;
INTClearFlag(INT_CN);
INTSetVectorPriority(INT_CHANGE_NOTICE_VECTOR, INT_PRIORITY_LEVEL_2);
INTSetVectorSubPriority(INT_CHANGE_NOTICE_VECTOR, INT_SUB_PRIORITY_LEVEL_1);
return TRUE;
}
开发者ID:MattAtHazmat,项目名称:TRISThis,代码行数:49,代码来源:commsToRPi.c
示例7: __ISR
void __ISR(_TIMER_4_VECTOR, IPL2SOFT) tick_timer_isr() {
INTClearFlag(INT_T4);
ColourEngine::Tick();
//toggle(PIO_LED2);
// Power toggle
if (_PORT(PIO_BTN1) == HIGH) {
last_btn1 = HIGH;
}
else if (last_btn1 == HIGH) {
last_btn1 = LOW;
power = (power == OFF) ? ON : OFF;
ColourEngine::SetPower(power, 1000);
}
// Switch mode
if (_PORT(PIO_BTN2) == HIGH) {
last_btn2 = HIGH;
}
else if (last_btn2 == HIGH) {
last_btn2 = LOW;
if (mode++ == (int)ColourEngine::NUM_MODES-1)
mode = 0;
ColourEngine::SetMode(static_cast<ColourEngine::mode_t>(mode), Q15(0.0001));
}
}
开发者ID:jorticus,项目名称:hexlight-firmware,代码行数:26,代码来源:main.cpp
示例8: AD_Init
/**
* @Function AD_Init
* @param None
* @return SUCCESS or ERROR
* @brief Initializes the A/D subsystem and enable battery voltage monitoring.
* @author Max Dunne, 2013.08.10 */
char AD_Init(void)
{
if (ADActive) {
return ERROR;
}
int pin = 0;
//ensure that the battery monitor is active
ActivePins = BAT_VOLTAGE_MONITOR;
ADActive = TRUE;
AD_SetPins();
for (pin = 0; pin < NUM_AD_PINS; pin++) {
ADValues[pin] = -1;
}
INTEnable(INT_AD1, INT_DISABLED);
INTClearFlag(INT_AD1);
INTSetVectorPriority(INT_ADC_VECTOR, 1);
INTSetVectorSubPriority(INT_ADC_VECTOR, 3);
INTEnable(INT_AD1, INT_ENABLED);
EnableADC10();
ADNewData = FALSE;
//wait for first reading to ensure battery monitor starts in the right spot
while (!AD_IsNewDataReady()) {
#ifdef AD_DEBUG_VERBOSE
PutChar('.');
#endif
}
//set the first values for the battery monitor filter
Filt_BatVoltage = AD_ReadADPin(BAT_VOLTAGE_MONITOR);
CurFilt_BatVoltage = Filt_BatVoltage;
PrevFilt_BatVoltage = Filt_BatVoltage;
return SUCCESS;
}
开发者ID:friend0,项目名称:panda_bot,代码行数:40,代码来源:AD.c
示例9: WF_EintInit
void WF_EintInit(void)
{
/* disable the external interrupt */
INTEnable(INT_INT1, INT_DISABLED); // disable interrupt
#if !defined(TCPIP_STACK_USE_EVENT_NOTIFICATION)
SYS_INT_DynamicRegister(MRFWB0M_INT_SOURCE, WF_NoEventISR, 0);
// #else the MRF ISR is already hooked by MRF24W_MACEventInit()!
#endif
/* configure IO pin as input and External Interrupt pin*/
/* set the I/O high since we do not have pull-ups */
INT1Rbits.INT1R = 0x0d; //select INT1 pin = RPE8
ANSELEbits.ANSE8 = 0; /* configure IO pin as input and External Interrupt pin*/
WF_INT_IO = 1; // PORTEbits.RE8 = 1; /* configure IO pin as input and External Interrupt pin*/
WF_INT_TRIS = 1; //TRISEbits.TRISE8 = 1 ; // ; /* set the I/O high since we do not have pull-ups */
WF_INT_EDGE = 0; //INTCONbits.INT1EP = 0; /* falling edge triggered */
/* clear and enable the interrupt */
INTClearFlag(INT_INT1) ; // clear status
INTSetVectorPriority(INT_EXTERNAL_1_VECTOR, 5); //set security level to 5
INTSetVectorSubPriority(INT_EXTERNAL_1_VECTOR,1); //set sub_security level to 1
// INTEnable(INT_INT1, INT_ENABLED); // Should not enable interrupt here
//---
}
开发者ID:ctapang,项目名称:v0_70_01b,代码行数:29,代码来源:drv_wifi_eint.c
示例10: __ISR
//=============================================
// Configure the ADC interrupt handler
//=============================================
void __ISR(_ADC_VECTOR, ADC_INT_PRIORITY) AdcInterruptHandler(void)
{
oAdcReady = 1;
Adc.Read(); // Read the enabled channels and puts them in Adc.Var.adcReadValues[]
INTClearFlag(INT_AD1); // Clear the ADC conversion done interrupt Flag
}
开发者ID:chinook,项目名称:ChinookMast,代码行数:10,代码来源:Interrupts.c
示例11: __ISR
/**
* @Function ADCIntHandler
* @param None
* @return None
* @brief Interrupt Handler for A/D. Reads all used pins into buffer.
* @note This function is not to be called by the user
* @author Max Dunne, 2013.08.25 */
void __ISR(_ADC_VECTOR, ipl1) ADCIntHandler(void)
{
unsigned char CurPin = 0;
INTClearFlag(INT_AD1);
for (CurPin = 0; CurPin <= PinCount; CurPin++) {
ADValues[CurPin] = ReadADC10(CurPin); //read in new set of values
}
//calculate new filtered battery voltage
Filt_BatVoltage = (Filt_BatVoltage * KEEP_FILT + AD_ReadADPin(BAT_VOLTAGE_MONITOR) * ADD_FILT) >> SHIFT_FILT;
SampleCount++;
if (SampleCount > PointsPerBatSamples) {//if sample time has passed
PrevFilt_BatVoltage = CurFilt_BatVoltage;
CurFilt_BatVoltage = Filt_BatVoltage;
SampleCount = 0;
//check for battery undervoltage check
if ((CurFilt_BatVoltage <= BAT_VOLTAGE_LOCKOUT) && (PrevFilt_BatVoltage <= BAT_VOLTAGE_LOCKOUT) && (AD_ReadADPin(BAT_VOLTAGE_MONITOR) > BAT_VOLTAGE_NO_BAT)) {
BOARD_End();
while (1) {
printf("Battery is undervoltage with reading %d, Stack is inoperable until charging\r\n", AD_ReadADPin(BAT_VOLTAGE_MONITOR));
while (!IsTransmitEmpty());
}
}
}
//if pins are changed add pins
if (PinsToAdd | PinsToRemove) {
AD_SetPins();
}
ADNewData = TRUE;
}
开发者ID:friend0,项目名称:panda_bot,代码行数:37,代码来源:AD.c
示例12: comms_tx_packet
//*************************************
//*************************************
//********** COMMS TX PACKET **********
//*************************************
//*************************************
//Call with:
// comms_tx_byte Check this is zero before loading comms_tx_buffer (confirms last tx is complete)
// comms_tx_buffer[] The packet data to send with the command in byte 0:1. The Length will automatically be added to bytes 2:3 by this function
// packet_length The number of data bytes excluding the checksum (which is automatically added by the tx function)
void comms_tx_packet (WORD packet_length)
{
//Packet format:
// CommandH | CommandL | LengthH | LengthL | 0-# Data Bytes | Checksum H | Checksum L
//Check last tx is complete
if (comms_tx_byte)
return;
if (packet_length > COMMS_TX_BUFFER_LENGTH)
return;
//----- START TX -----
comms_tx_no_of_bytes_to_tx = packet_length; //no of bytes to tx (excluding checksum)
//Set the length bytes
comms_tx_buffer[2] = (BYTE)(packet_length >> 8);
comms_tx_buffer[3] = (BYTE)(packet_length & 0x00ff);
//comms_rx_no_of_bytes_to_rx = 0xfffe; //If you want to reset rx
//comms_rx_1ms_timeout_timer = ;
comms_tx_byte = 0;
comms_tx_chksum = (WORD)comms_tx_buffer[0];
INTClearFlag(INT_SOURCE_UART_TX(COMMS_UART_NAME));
UARTSendDataByte(COMMS_UART_NAME, comms_tx_buffer[comms_tx_byte++]); //Manually trigger the first tx
INTEnable(INT_SOURCE_UART_TX(COMMS_UART_NAME), INT_ENABLED);
}
开发者ID:godzivan,项目名称:C_Communications_UART_PIC32_Full_Duplex,代码行数:40,代码来源:ap-comms.c
示例13: MyMIWI_Init
void MyMIWI_Init(void) {
// Configure Pins for MRF24J40MB
mPORTESetBits(RST_MIWI);
mPORTESetPinsDigitalOut(RST_MIWI);
mPORTBSetBits(MIWI_WAKE);
mPORTBSetPinsDigitalOut(MIWI_WAKE);
// Configure the INT3 controller for MIWI
// Set RD10/INT3 as input
mPORTDSetPinsDigitalIn(BIT_10);
// Clear corresponding bits in INTCON for falling edge trigger
INTCONCLR = _INTCON_INT3EP_MASK;
// Set up interrupt prioirty and sub-priority
INTSetVectorPriority(INT_EXTERNAL_3_VECTOR, My_INT_EXTERNAL_3_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_3_VECTOR, My_INT_EXTERNAL_3_SUB_PRIORITY);
// Clear the interrupt flags
INTClearFlag(INT_INT3);
// Enable INT3
INTEnable(INT_INT3, INT_ENABLED);
// WARNING : Change in file MRF24J40.c in Microchip Application Library
// the line : void __ISR(_EXTERNAL_1_VECTOR, ipl4) _INT1Interrupt(void)
// by : void __ISR(_EXTERNAL_3_VECTOR, ipl4) _INT3Interrupt(void)
}
开发者ID:lechienv,项目名称:ProgSandbot,代码行数:26,代码来源:MyMIWI.c
示例14: __ISR
void __ISR(_TIMER_4_VECTOR, IPL7AUTO) TimerBlinkHandler(void)
{
// check the LED blink flags
if (V.blink_alt) {
if (V.blink & 0b00000001) LEDS.out_bits.b0 = !LEDS.out_bits.b0;
if (V.blink & 0b00000010) LEDS.out_bits.b1 = !LEDS.out_bits.b0;
if (V.blink & 0b00000100) LEDS.out_bits.b2 = !LEDS.out_bits.b2;
if (V.blink & 0b00001000) LEDS.out_bits.b3 = !LEDS.out_bits.b2;
if (V.blink & 0b00010000) LEDS.out_bits.b4 = !LEDS.out_bits.b4;
if (V.blink & 0b00100000) LEDS.out_bits.b5 = !LEDS.out_bits.b4;
if (V.blink & 0b01000000) LEDS.out_bits.b6 = !LEDS.out_bits.b6;
if (V.blink & 0b10000000) LEDS.out_bits.b7 = !LEDS.out_bits.b6;
} else {
if (V.blink & 0b00000001) LEDS.out_bits.b0 = !LEDS.out_bits.b0;
if (V.blink & 0b00000010) LEDS.out_bits.b1 = !LEDS.out_bits.b1;
if (V.blink & 0b00000100) LEDS.out_bits.b2 = !LEDS.out_bits.b2;
if (V.blink & 0b00001000) LEDS.out_bits.b3 = !LEDS.out_bits.b3;
if (V.blink & 0b00010000) LEDS.out_bits.b4 = !LEDS.out_bits.b4;
if (V.blink & 0b00100000) LEDS.out_bits.b5 = !LEDS.out_bits.b5;
if (V.blink & 0b01000000) LEDS.out_bits.b6 = !LEDS.out_bits.b6;
if (V.blink & 0b10000000) LEDS.out_bits.b7 = !LEDS.out_bits.b7;
}
Drive_leds();
V.blink_count++;
INTClearFlag(INT_T4);
}
开发者ID:nsaspook,项目名称:cpanel,代码行数:26,代码来源:blinker.c
示例15: __ISR
/**
* This is the ISR for the ADC1 peripheral. It has been enabled to run continuously. Reads all 8
* samples from the ADC, averages them, and stores them in a module-level variable for use in the
* main event loop.
*/
void __ISR(_ADC_VECTOR, IPL2AUTO) AdcHandler(void)
{
// Clear the interrupt flag.
INTClearFlag(INT_AD1);
}
开发者ID:Dustboonies,项目名称:CE13Lab6,代码行数:12,代码来源:bounce_ec.c
示例16: vUART1_ISR
void vUART1_ISR( void )
{
static portBASE_TYPE
xHigherPriorityTaskWoken;
UART_DATA rx_data;
static int i = 0;
if( INTGetFlag( INT_U1RX ) )
{
INTClearFlag( INT_U1RX );
/*----------------------------------------------------------------------
Rx interrupt functionality
----------------------------------------------------------------------*/
rx_data = UARTGetData( TARGET_UART );
rx_buffer = rx_data.__data;
xHigherPriorityTaskWoken = xTaskResumeFromISR( rx_task_handle );
xSemaphoreGiveFromISR( inputByteBuffer, &xHigherPriorityTaskWoken );
// set Rx task to resume
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
else
{
if( INTGetFlag( INT_U1TX ) )
{
INTClearFlag( INT_U1TX );
/*------------------------------------------------------------------
Tx interrupt functionality
------------------------------------------------------------------*/
// transmit tx_buffer
if( tx_buffer[ i ] != '\0' )
UARTSendDataByte( TARGET_UART, tx_buffer[ i++ ] );
else
{
i = 0;
xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR( outputStringBuffer, &xHigherPriorityTaskWoken );
}
}
}
}
开发者ID:joshuadurkee,项目名称:CST347-Lab8,代码行数:46,代码来源:uartdrv.c
示例17: __ISR
void __ISR(_TIMER_2_VECTOR, ipl2) Timer2_ISR(void) {
if (INTGetFlag(INT_T2)){
millisec++;
stopDelayCounter++;
startDelayCounter++;
INTClearFlag(INT_T2); // Acknowledge the interrupt source by clearing its flag.
}
}
开发者ID:cdauchess,项目名称:VTMDAQ_EXPERIMENTAL,代码行数:8,代码来源:main.c
示例18: __attribute__
void __attribute__((vector(47), interrupt(ipl4), nomips16)) CAN2InterruptHandler(void)
{
/* This is the CAN2 Interrupt Handler. Note that there
* are many events in the CAN2 module that can cause
* this interrupt. These events are enabled by the
* CANEnableModuleEvent() function. In this example,
* only the RX_EVENT is enabled. */
/* Check if the source of the interrupt is RX_EVENT.
* This is redundant since only this event is enabled
* in this example but this shows one scheme for handling
* interrupts. */
if((CANGetModuleEvent(CAN2) & CAN_RX_EVENT) != 0)
{
/* Within this, you can check which event caused the
* interrupt by using the CANGetPendingEventCode() function
* to get a code representing the highest priority active
* event.*/
if(CANGetPendingEventCode(CAN2) == CAN_CHANNEL1_EVENT)
{
/* This means that channel 1 caused the event.
* The CAN_RX_CHANNEL_NOT_EMPTY event is persistent. You
* could either read the channel in the ISR
* to clear the event condition or as done
* here, disable the event source, and set
* an application flag to indicate that a message
* has been received. The event can be
* enabled by the application when it has processed
* one message.
*
* Note that leaving the event enabled would
* cause the CPU to keep executing the ISR since
* the CAN_RX_CHANNEL_NOT_EMPTY event is persistent (unless
* the not empty condition is cleared.)
* */
CANEnableChannelEvent(CAN2, CAN_CHANNEL1, CAN_RX_CHANNEL_NOT_EMPTY, FALSE);
isCAN2MsgReceived = TRUE;
}
}
/* The CAN2 Interrupt flag is cleared at the end of the
* interrupt routine. This is because the event
* that could have caused this interrupt to occur
* (CAN_RX_CHANNEL_NOT_EMPTY) is disabled. Attempting to
* clear the CAN2 interrupt flag when the the CAN_RX_CHANNEL_NOT_EMPTY
* interrupt is enabled will not have any effect because the
* base event is still present. */
INTClearFlag(INT_CAN2);
}
开发者ID:kilohotel3,项目名称:VTM-DAQ,代码行数:57,代码来源:CANFunctions.c
示例19: __ISR
void __ISR(_EXTERNAL_1_VECTOR, ipl7auto) Ext3Handler_PmodACLInt1(void)
{
//we have data, signal main loop to collect
aclDataReady = 1;
portBASE_TYPE taskWoken;
// OC1CONbits.ON = 1;
//xSemaphoreGiveFromISR (sema, &taskWoken);
INTClearFlag(INT_INT1);
}
开发者ID:shank8,项目名称:CS466_Project4,代码行数:9,代码来源:main.c
示例20: __ISR
void __ISR(_UART1_VECTOR, IPL2SOFT) IntUart1Handler(void)
{
if(INTGetFlag(INT_SOURCE_UART_RX(UART1)))
{
INTClearFlag(INT_SOURCE_UART_RX(UART1));
if (uart_rx_count<sizeof(uart_rx_buff)-1)
uart_rx_count++;
else
uart_rx_count=0; // overflow
uart_rx_buff[uart_rx_count]=UARTGetDataByte(UART1);
}
if(INTGetFlag(INT_SOURCE_UART_TX(UART1)))
{
INTClearFlag(INT_SOURCE_UART_TX(UART1));
}
}
开发者ID:antibyte,项目名称:NasMini.X,代码行数:18,代码来源:uart.c
注:本文中的INTClearFlag函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论