ANSI-C/cC++ Compiler for HC12 V-5.0.32 Build 6345, Dec 12 2006

    1:  //**********************************************************************
    2:  //ECE331 Lab 2 Flashlight.c demo program
    3:  ///C-language implementation of flashlight program (KEH, August 2009)
    4:  //Hardware interface: SW on input pin PAD6 (HIGH level when not pressed)
    5:  //                    LED on output pin PT1 (Turn on with HIGH level)
    6:  //**********************************************************************
    7:  #define PTAD  (*(unsigned char *) 0x270)  /* Define register addresses */
    8:  #define DDRAD  (*(unsigned char *) 0x272)
    9:  #define PTT  (*(unsigned char *) 0x240)
   10:  #define DDRT  (*(unsigned char *) 0x242)
   11:  #define ATDDIEN  (*(unsigned char *) 0x8D)
   12:  #pragma LINK_INFO DERIVATIVE "mc9s12c128"		/* Tell linker to allocate the program into the 
   13:  										 	                          RAM and (Flash) ROM address spaces										 	              											                          that conform to those available on the 
   14:  											                          of the 9S12C128 microcontroller. */
   15:  void main(void) 
   16:  { 

Function: main
Source  : Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\Sources\main.c
Options : -CPUHCS12 -D__NO_FLOAT__ -Env"GENPATH=Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight;Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\bin;Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\prm;Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\cmd;Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\Sources;C:\Program Files\Freescale\Codewarrior for HC12 V4.6\lib\HC12c\lib;C:\Program Files\Freescale\Codewarrior for HC12 V4.6\lib\HC12c\src;C:\Program Files\Freescale\Codewarrior for HC12 V4.6\lib\HC12c\include" -Env"LIBPATH=C:\Program Files\Freescale\Codewarrior for HC12 V4.6\lib\HC12c\include" -Env"OBJPATH=Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\bin" -Env"TEXTPATH=Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\bin" -Lasm="Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\C_flashlight_Data\P&E_Multilink_CyclonePro\ObjectCode\main.c.o.lst" -Ms -ObjN="Y:\ece331\Labs\331_Lab2 (C programming and Double Click Detector)\C_Flashlight\C_flashlight\C_flashlight_Data\P&E_Multilink_CyclonePro\ObjectCode\main.c.o"

   17:    DDRT =    0b00000010;   // LED on PT1 */
  0000 cc4002       [2]     LDD   #16386
  0003 7b0242       [3]     STAB  578
   18:    ATDDIEN = 0b01000000;   // Make PAD6 a digital I/O pin
  0006 5a8d         [2]     STAA  141
   19:    DDRAD =   0b00000000;   // Make PAD6 an input (Switch on this pin) */
  0008 790272       [3]     CLR   626
   20:    for(;;) 
   21:    { 
   22:      PTT = PTT & 0b11111101;                     // Turn OFF LED
  000b 1d024002     [4]     BCLR  576,#2
   23:      while ((PTAD & 0b01000000) == 0b01000000);	// Hang here while SW not pressed (HIGH).
  000f 1e027040fb   [5]     BRSET 624,#64,*+0 ;abs = 000f
   24:      PTT = PTT | 0b00000010;                     // Turn on LED .
  0014 1c024002     [4]     BSET  576,#2
   25:      while ((PTAD & 0b01000000) == 0);           // Hang here while SW pressed (LOW)
  0018 1f027040fb   [5]     BRCLR 624,#64,*+0 ;abs = 0018
  001d 20ec         [3]     BRA   *-18 ;abs = 000b
   26:    }
   27:  }
   28: