This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timer

Hi

I just got this program from keil and i am tryin to understand and i hope somebody out there can help me.
First:I dont understand how this simple line
define Port_D XBYTE [0xFFA0]defines port 1(bit 0,1,4,5).What is FFA0 doin there?

Second:What is the line below doing? #define _CLOCKVAL ((unsigned int) ((XTAL/(12/(X2+1))) * INT_CLOCK))

Thanx in advance

Martin


#define Port_D XBYTE [0xFFA0]
// bit 0: switch S1

// bit 1: switch S2

// bit 4: LED D1

// bit 5: LED D2
#define DipSwitch XBYTE [0xFF80]

static unsigned char IOinfo = 0xFF;
static bit SendInfo;


/******************************************************************************/
/* Timer 0 interrupt service function */
/* executes each 1ms @ 20 MHz Crystal Clock */
/******************************************************************************/
#define INT_CLOCK 0.001 // timer interval 0.001Sec
#define XTAL 20000000
#define X2 0 // set to 1 if in X2 Mode

#define _CLOCKVAL ((unsigned int) ((XTAL/(12/(X2+1))) * INT_CLOCK))

#define T0_CLOCK ((-_CLOCKVAL)+13)

Parents Reply Children
No data