[ create a new paste ] login | about

Link: http://codepad.org/26h98m9r    [ raw code | output | fork ]

C, pasted on Apr 22:
#define   ENABLE_BIT_DEFINITIONS 
#include "iocan32.h"
#include "inavr.h"

#include "port.h"
#include "fled.h"

#include "mb.h"
#include "mbport.h"

/********************************************************************************
*                 defines
*******************************************************************************/
#define MB_TIMER_PRESCALER      ( 1024UL )
#define MB_TIMER_TICKS          ( F_CPU / MB_TIMER_PRESCALER )
#define MB_50US_TICKS           ( 20000UL )
/********************************************************************************
*                 vars
*******************************************************************************/
static USHORT   usTimerOCRADelta;
//static USHORT   usTimerOCRBDelta;
/********************************************************************************
*                 global
*******************************************************************************/
BOOL
xMBPortTimersInit( USHORT usTim1Timerout50us )
{
    /* Calculate overflow counter an OCR values for Timer1. */
    usTimerOCRADelta =
        ( MB_TIMER_TICKS * usTim1Timerout50us ) / ( MB_50US_TICKS );

    TCCR1A = 0x00;
    TCCR1B = 0x00;
    TCCR1C = 0x00;

    vMBPortTimersDisable(  );

    return TRUE;
}


inline void
vMBPortTimersEnable(  )
{
    TCNT1 = 0x0000;
    if( usTimerOCRADelta > 0 )
    {
        TIMSK1 |= ( 1<<OCIE1A );
        OCR1A = usTimerOCRADelta;
    }

    TCCR1B |= ( 1<<CS12 ) | ( 1<<CS10 );
}

inline void
vMBPortTimersDisable(  )
{
    /* Disable the timer. */
    TCCR1B &= ~(( 1<<CS12 ) | ( 1<<CS10 ));
    /* Disable the output compare interrupts for channel A/B. */
    TIMSK1 &= ~(1<<OCIE1A );
    /* Clear output compare flags for channel A/B. */
    TIFR1 |= ( 1<<OCF1A ) ;
}

#pragma vector=TIMER1_COMPA_vect 
__interrupt void timer1CompAInterruptHandler ( void )
{
    ( void )pxMBPortCBTimerExpired(  );
}
/********************************************************************************
*                 EOF
*******************************************************************************/


Output:
Line 20: error: iocan32.h: No such file or directory
Line 18: error: inavr.h: No such file or directory
Line 17: error: port.h: No such file or directory
Line 17: error: fled.h: No such file or directory
Line 15: error: mb.h: No such file or directory
Line 19: error: mbport.h: No such file or directory
Line 20: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'usTimerOCRADelta'
Line 26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xMBPortTimersInit'
In function 'vMBPortTimersEnable':
Line 45: error: 'TCNT1' undeclared (first use in this function)
Line 45: error: (Each undeclared identifier is reported only once
Line 45: error: for each function it appears in.)
Line 46: error: 'usTimerOCRADelta' undeclared (first use in this function)
Line 48: error: 'TIMSK1' undeclared (first use in this function)
Line 48: error: 'OCIE1A' undeclared (first use in this function)
Line 49: error: 'OCR1A' undeclared (first use in this function)
Line 52: error: 'TCCR1B' undeclared (first use in this function)
Line 52: error: 'CS12' undeclared (first use in this function)
Line 52: error: 'CS10' undeclared (first use in this function)
In function 'vMBPortTimersDisable':
Line 59: error: 'TCCR1B' undeclared (first use in this function)
Line 59: error: 'CS12' undeclared (first use in this function)
Line 59: error: 'CS10' undeclared (first use in this function)
Line 61: error: 'TIMSK1' undeclared (first use in this function)
Line 61: error: 'OCIE1A' undeclared (first use in this function)
Line 63: error: 'TIFR1' undeclared (first use in this function)
Line 63: error: 'OCF1A' undeclared (first use in this function)
t.c: At top level:
Line 67: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'


Create a new paste based on this one


Comments: