コード例 #1
0
ファイル: main.c プロジェクト: kerikun11/MPLABXProjects
void interrupt ISR(void) {
    USB_CDC_ISR();
    UART_ISR();
    I2C_ISR();
    if (INTCONbits.T0IF && INTCONbits.T0IE) {
        INTCONbits.T0IF = 0;
    }
    if (PIR1bits.TMR1IF && PIE1bits.TMR1IE) {
        PIR1bits.TMR1IF = 0;
        TMR1H = 0xC0;
    }
    if (PIR2bits.TMR3IF && PIE2bits.TMR3IE) {
        PIR2bits.TMR3IF = 0;
    }
}
コード例 #2
0
ファイル: MCU_B1.c プロジェクト: ericluo1123/myPicCode
//ISR
void interrupt ISR(void)// interrupt 0	// ISR (Interrupt Service Routines)
{	
	IOC_ISR();
	
	TMR0_ISR();
		
	TMR1_ISR();
		
//	TMR2_ISR();
	
	INT_ISR();
	
	UART_ISR();	

	I2C_ISR();
}
コード例 #3
0
void interrupt ISR(void) {
    UART_ISR();
    if(INTCONbits.TMR0IF) {
        INTCONbits.TMR0IF = 0;
        static uint8_t prev_A;
        static uint8_t prev_B;
        LATB7 = !LATB7;
        if (A_PULSE != prev_A) {
            prev_A = A_PULSE;
            if (A_PULSE) {
                if (B_PULSE) {
                    encoder--;
                } else {
                    encoder++;
                }
            } else {
                if (B_PULSE) {
                    //encoder++;
                } else {
                    //encoder--;
                }
            }
        }
        if (B_PULSE != prev_B) {
            prev_B = B_PULSE;
            if (B_PULSE) {
                if (A_PULSE) {
                    //encoder++;
                } else {
                    //encoder--;
                }
            } else {
                if (A_PULSE) {
                    //encoder--;
                } else {
                    //encoder++;
                }
            }
        }
    }
}
コード例 #4
0
ファイル: Events.c プロジェクト: SeismicPi/SeismicPi
/*
** ===================================================================
**     Event       :  UART_OnRxChar (module Events)
**
**     Component   :  UART [AsynchroSerial]
**     Description :
**         This event is called after a correct character is received.
**         The event is available only when the <Interrupt
**         service/event> property is enabled and either the <Receiver>
**         property is enabled or the <SCI output mode> property (if
**         supported) is set to Single-wire mode.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void UART_OnRxChar(void)
{
	UART_ISR();
}
コード例 #5
0
ファイル: uart.c プロジェクト: NodeUSB/mppt_charger
#include "uart.h"

#include <xc.h>
#include <stdint.h>
#include "platform.h"

#define BUFFER_SIZE 32
#define BUFFER_MASK (BUFFER_SIZE - 1)

volatile char rxbuffer[BUFFER_SIZE];
volatile char txbuffer[BUFFER_SIZE];
volatile uint8_t txip, txop, rxip, rxop;

void interrupt isr(void){
	UART_ISR()
}

void uart_init(unsigned long baud){
	unsigned long spbrg_calc = ((_XTAL_FREQ/baud)/16)-1;
	SPBRG = spbrg_calc;
	txip = txop = rxip = rxop = 0;
	TXSTAbits.BRGH = 1;
	RCSTAbits.CREN = 1;
	PIE1bits.RCIE = 1;
	TXSTAbits.TXEN = 1;
	RCSTAbits.SPEN = 1;

	PIR1bits.TXIF = 0;
	PIR1bits.RCIF = 0;
}