Ejemplo n.º 1
0
void LowInterrupt(void)
{
    if(INTCONbits.TMR0IF == 1){
        TickUpdate();
        INTCONbits.TMR0IF = 0;
    }
}
Ejemplo n.º 2
0
    void interrupt HighISR(void)
#endif
{
    //TMR0 is used for the ticks
    if (INTCON_TMR0IF)
    {
        TickUpdate();

        #if defined(STACK_USE_SLIP)
        MACISR();
        #endif

        INTCON_TMR0IF = 0;
    }


    #ifdef SER_USE_INTERRUPT
    //USART Receive
	if(PIR1_RCIF && PIE1_RCIE)
	{
        serRxIsr();
	}

    //USART Transmit
	if(PIR1_TXIF && PIE1_TXIE)
	{
        serTxIsr();
	}
    #endif
}
Ejemplo n.º 3
0
void interrupt low_priority LowISR(void) {
	if(INTCONbits.TMR0IF) {
		TickUpdate();
	}
	if (TMR2IF) {
		pwmUpdate();
		TMR2IF = 0;
	}
}
Ejemplo n.º 4
0
    void interrupt HighISR(void)
#endif
{
    TickUpdate();

#if defined(STACK_USE_SLIP)
    MACISR();
#endif
}
Ejemplo n.º 5
0
    void interrupt HighISR(void)
#endif
{
    //TMR0 is used for the ticks
    if (INTCON_TMR0IF)
    {
        TickUpdate();

        #if defined(STACK_USE_SLIP)
        MACISR();
        #endif

        INTCON_TMR0IF = 0;
    }
}
Ejemplo n.º 6
0
    void interrupt HighISR(void)
#endif
{
    /////////////////////////////////////////////////
    //TMR0 is used for the ticks
    if (INTCON_TMR0IF)
    {
        TickUpdate();

        #if defined(STACK_USE_SLIP)
        MACISR();
        #endif

        INTCON_TMR0IF = 0;
    }


    /////////////////////////////////////////////////
    //USART1
    if(PIR1_RCIF && PIE1_RCIE)  //USART1 Receive
    {
        serRxIsr();
    }

    //USART1 Transmit
    if(PIR1_TXIF && PIE1_TXIE)
    {
        serTxIsr();
    }


    #if defined(BRD_SBC65EC)
    /////////////////////////////////////////////////
    //USART2
    if(PIR3_RC2IF && PIE3_RC2IE)  //USART2 Receive
    {
        ser2RxIsr();
    }

    //USART2 Transmit
    if(PIR3_TX2IF && PIE3_TX2IE)
    {
        ser2TxIsr();
    }
    #endif
}
Ejemplo n.º 7
0
    void interrupt HighISR(void)
#endif
{
    //TMR0 is used for the ticks
    if (INTCON_TMR0IF)
    {
        TickUpdate();

        #if defined(STACK_USE_SLIP)
        MACISR();
        #endif

        INTCON_TMR0IF = 0;
    }


    #ifdef SER_USE_INTERRUPT
    //USART Receive
	if(PIR1_RCIF && PIE1_RCIE)
	{
        serRxIsr();
	}

    //USART Transmit
	if(PIR1_TXIF && PIE1_TXIE)
	{
        serTxIsr();
	}
    #endif

	// ERRIF: CAN bus Error Interrupt Flag bit
	if ( PIR3bits.ERRIF ) 
	{
		// save the comstat register for analysis later on
		g_can_error = COMSTAT;
		COMSTAT = 0;
		PIR3 = 0;	
	}
	// CAN support
}
Ejemplo n.º 8
0
Archivo: Main.c Proyecto: spa-pal/KO5
     void LowISR(void)
 #endif
     {
     
         TickUpdate();
             
         if (INTCON3bits.INT1IF)
         {
             INTCON3bits.INT1IF=0;
             INTCON2bits.INTEDG1^=1;
     
     //          DeviceData.LogIn1++;    
             {
                 char pin_temp;
                 pin_temp     = PORTB&0x0f;
                 data_temp    = (pin_temp & 0x0c) >> 2;
                 control_temp = 0;
                 control_temp = (pin_temp & 0x03) >> 1;
                 if (pin_temp & 0x01)
                     control_temp |= 0x02;
                 puart_data_temp  |= (data_temp << (control_temp * 2));
                 if (control_temp == 0x03)
                 {
                     //DeviceData.LogIn1++;  
                     puart_rx_buffer[puart_rx_wr_index]=puart_data_temp;
                     bPUART_RXIN=1;
                     puart_rx_wr_index++;
                     if (puart_rx_wr_index >= PUART_RX_BUFFER_SIZE)
                     {
                         puart_rx_wr_index=0;
                     }
                     if (puart_data_temp==0x0a)
                     {
                     }
                     puart_data_temp=0;
                 }
             }
         }
Ejemplo n.º 9
0
void LowISR(void)
{
    TickUpdate();
}
Ejemplo n.º 10
0
        void LowISR(void)
    #endif
    {
	TickUpdate();
    }
Ejemplo n.º 11
0
static BOOL DownloadMPFS(void)
{
    enum SM_MPFS
    {
        SM_MPFS_SOH,
        SM_MPFS_BLOCK,
        SM_MPFS_BLOCK_CMP,
        SM_MPFS_DATA,
    } state;

    BYTE c;
    MPFS handle;
    BOOL lbDone;
    BYTE blockLen;
    BYTE lResult;
    BYTE tempData[XMODEM_BLOCK_LEN];
    TICK lastTick;
    TICK currentTick;

    state = SM_MPFS_SOH;
    lbDone = FALSE;

    handle = MPFSFormat();

    /*
     * Notify the host that we are ready to receive...
     */
    lastTick = TickGet();
    do
    {
        /*
         * Update tick here too - just in case interrupt is not used.
         */
        TickUpdate();

        currentTick = TickGet();
        if ( TickGetDiff(currentTick, lastTick) >= (TICK_SECOND/2) )
        {
            lastTick = TickGet();
            USARTPut(XMODEM_NAK);

            /*
             * Blink LED to indicate that we are waiting for
             * host to send the file.
             */
            //LATA2 ^= 1;
        }

    } while( !USARTIsGetReady() );


    while(!lbDone)
    {
        /*
         * Update tick here too - just in case interrupt is not used.
         */
        TickUpdate();

        if ( USARTIsGetReady() )
        {
            /*
             * Toggle LED as we receive the data from host.
             */
            //LATA2 ^= 1;
            c = USARTGet();
        }
        else
        {
            /*
             * Real application should put some timeout to make sure
             * that we do not wait forever.
             */
            continue;
        }

        switch(state)
        {
        default:
            if ( c == XMODEM_SOH )
            {
                state = SM_MPFS_BLOCK;
            }
            else if ( c == XMODEM_EOT )
            {
                /*
                 * Turn off LED when we are done.
                 */
                //LATA2 = 1;

                MPFSClose();
                USARTPut(XMODEM_ACK);
                lbDone = TRUE;
            }
            else
                USARTPut(XMODEM_NAK);

            break;

        case SM_MPFS_BLOCK:
            /*
             * We do not use block information.
             */
            lResult = XMODEM_ACK;
            blockLen = 0;
            state = SM_MPFS_BLOCK_CMP;
            break;

        case SM_MPFS_BLOCK_CMP:
            /*
             * We do not use 1's comp. block value.
             */
            state = SM_MPFS_DATA;
            break;

        case SM_MPFS_DATA:
            /*
             * Buffer block data until it is over.
             */
            tempData[blockLen++] = c;
            if ( blockLen > XMODEM_BLOCK_LEN )
            {
                /*
                 * We have one block data.
                 * Write it to EEPROM.
                 */
                MPFSPutBegin(handle);

                lResult = XMODEM_ACK;
                for ( c = 0; c < XMODEM_BLOCK_LEN; c++ )
                    MPFSPut(tempData[c]);

                handle = MPFSPutEnd();

                USARTPut(lResult);
                state = SM_MPFS_SOH;
            }
            break;

        }

    }


/*
 * This small wait is required if SLIP is in use.
 * If this is not used, PC might misinterpret SLIP
 * module communication and never close file transfer
 * dialog box.
 */
#if defined(STACK_USE_SLIP)
    {
        BYTE i;
        i = 255;
        while( i-- );
    }
#endif
    return TRUE;
}