3–331
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
NOTE. THIS WAS COMPILED WITH A COMPILER COURTESY OF:
INTROL CORP.
9220 W. HOWARD AVE.
MILWAUKEE, WI. 53228
PHONE (414) 327–7734.
SOME SOURCE CODE CHANGES MAY BE NECESSARY FOR COMPILATION WITH OTHER COMPILERS.
THE HEADER FILE io6811.h HAS I/O PORT DEFINITIONS FOR THE I/O PORTS PARTICULAR TO THE MC68HC711E9. A TYPICAL ENTRY FOR
PORT A WILL FOLLOW. THE FIRST LINE ESTABLISHES A BASE ADDRESS BY WHICH ALL I/O FACILITIES AND COUNTERS ARE BIASED.
REFER TO THE MC68HC711E9 DATA FOR MORE INFORMATION RELATIVE TO I/O AND TIMER ADDRESSES.
#define
IOBIAS 0x1000 /* BASE ADDRESS OF THE I/O FOR THE 68HC11 */
#define PORTA (* (char *) (IOBIAS + 0)) /* PORT A */
THE STARTUP ROUTINE NEED ONLY LOAD THE STACK TO THE TOP OF RAM, ZERO
THE MICROCONTROLLER’S RAM AND PERFORM A BSR MAIN (BRANCH TO SUBROUTINE “MAIN”).
THIS SOURCE CODE, HEADER FILE, COMPILED OBJECT CODE, AND LISTING FILES ARE AVAILABLE ON:
THE MOTOROLA FREEWARE LINE
AUSTIN, TX.
(512) 891–3733.
Bill Lucas 6/21/90
THE CODE STARTS HERE */
#include <io6811.h> /* I/O port definitions */
/* define locations in the eeprom to store calibration information */
#define EEPROM (char*)0xb600 /* used by calibration functions */
#define EEBASE 0xb600 /* start address of the eeprom */
#define ADZERO (* ( long int *)( EEBASE + 0 )) /* auto zero value */
#define HIATOD (* ( long int *)( EEBASE + 4 )) /* full scale measured input */
#define XDCRMAX (* ( char *)( EEBASE + 8 )) /* full scale input of the xdcr */
union bytes {
unsigned long int l;
char b[4];
}; /* ADZERO.l for long word ADZERO.b[0]; for byte */
const char lcdtab[] = { 95, 6, 59, 47, 102, 109, 125, 7, 127, 111, 0 };
/* lcd pattern table 0 1 2 3 4 5 6 7 8 9 blank */
const int dectable[] = { 10000, 1000, 100, 10 };
char digit[5]; /* buffer to hold results from cvt_bin_dec function */
/* ################################################################### */
/* real time interrupt service routine */
void real_time_interrupt (void) /* hits every 4.096 ms. */
{
TFLG2 = 0x40; /* clear the interrupt flag */
}
/* ################################################################### */
/* ################################################################### */
/*
void write_eeprom(char data, char *address)
{
PPROG = 0x16;
*address = 0xff;
PPROG = 0x17;
write_eeprom(0xA5,EEPROM); write A5h to first byte of EEPROM */
/* single–byte erase mode */
/* write anything */
/* turn on programming voltage */
delay();
PPROG = 0x0; /* erase complete */
/* now program the data */
PPROG = 0x02;
*address = data;
PPROG = 0x03; /* set eelat and eepgm bits */
delay();
PPROG = 0;
/* programming complete */
}
/* ################################################################### */
/* set eelat bit */
/* write data */
/* read mode */
long int convert(char polarity)
F
Freescale Semiconductor, Inc.
n
.