
3–257
Motorola Sensor Device Data
For More Information On This Product,
  Go to: www.freescale.com
0A07 3F 5C     CLR    $5C         
0A09 B7 5D     STA    $5D         
0A0B 81        RTS                }
/***************************************************************************/
void initio (void)     /*  setup the I/O */
{
0A0C A6 20     LDA    #$20            adstat = 0x20; /* power–up the A/D */
0A0E B7 09     STA    $09         
0A10 3F 02     CLR    $02             porta = portb = portc = 0;
0A12 3F 01     CLR    $01         
0A14 3F 00     CLR    $00         
0A16 A6 FF     LDA    #$FF            ddra = ddrb = ddrc = 0xff;
0A18 B7 06     STA    $06         
0A1A B7 05     STA    $05         
0A1C B7 04     STA    $04         
0A1E B6 13     LDA    $13             areg=tsr;  /* dummy read */
0A20 3F 1E     CLR    $1E             ocmphi1 = ocmphi2 = 0;
0A22 3F 16     CLR    $16         
0A24 B6 1F     LDA    $1F             areg = ocmplo2; /* clear out output compare 2 if it happens to be set */
0A26 AD 9F     BSR    $09C7           fixcompare(); /* set–up for the first timer interrupt */
0A28 A6 40     LDA    #$40            tcr = 0x40;
0A2A B7 12     STA    $12         
0A2C 9A        CLI                    CLI;  /* let the interrupts begin !  */
/* write CAL to the display */
0A2D A6 CC     LDA    #$CC            portc = 0xcc; /* C */
0A2F B7 02     STA    $02         
0A31 A6 BE     LDA    #$BE            portb = 0xbe; /* A */
0A33 B7 01     STA    $01         
0A35 A6 C4     LDA    #$C4            porta = 0xc4; /* L */
0A37 B7 00     STA    $00         
0A39 CD 09 21  JSR    $0921           sensor_type(); /* get the model of the sensor based on J1..J3 */
0A3C AD AD     BSR    $09EB           adzero();  /* auto zero */
0A3E 81        RTS                   }
/***************************************************************************/
void cvt_bin_dec(unsigned long arg)
/* First converts the argument to a five digit decimal value. The msd is in
the lowest address. Then leading zero suppress the value and write it to the
display ports.
The argument value is 0..65535 decimal. */
009D                              {
0A3F BF 9D     STX    $9D         
0A41 B7 9E     STA    $9E         
009F                              char i;
00A0                              unsigned long l;
0A43 3F 9F     CLR    $9F           for ( i=0; i < 5; ++i )
0A45 B6 9F     LDA    $9F         
0A47 A1 05     CMP    #$05        
0A49 24 07     BCC    $0A52       
{
0A4B 97        TAX                      digit[i] = 0x0;  /* put blanks in all digit positions */
0A4C 6F 50     CLR    $50,X      
}
0A4E 3C 9F     INC    $9F         
0A50 20 F3     BRA    $0A45       
0A52 3F 9F     CLR    $9F                for ( i=0; i < 4; ++i )
0A54 B6 9F     LDA    $9F         
0A56 A1 04     CMP    #$04        
0A58 24 7A     BCC    $0AD4       
{
0A5A 97        TAX                             if ( arg  >= dectable [i] )
0A5B 58        LSLX               
0A5C D6 08 0B  LDA    $080B,X     
0A5F B0 9E     SUB    $9E         
0A61 B7 58     STA    $58         
0A63 B6 9D     LDA    $9D         
0A65 A8 80     EOR    #$80        
0A67 B7 57     STA    $57         
0A69 D6 08 0A  LDA    $080A,X     
0A6C A8 80     EOR    #$80        
0A6E B2 57     SBC    $57         
F
Freescale Semiconductor, Inc.
n
.