⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slave.lst

📁 汽车电子上现在最火热的总线之一LIN总线的单片机实现。
💻 LST
📖 第 1 页 / 共 2 页
字号:
  161:      
  162:  	#ifdef QL4LINKit							   // LED active high 
  163:      if (LEDs & 0x08) PTB_PTB0 = 1; else PTB_PTB0 = 0; 
  0025 a508             BIT   #8
  0027 2703             BEQ   L2C ;abs = 002c
  0029 1000             BSET  0,_PTB
  002b 65               SKIP2 L2E ;abs = 002e
  002c          L2C:    
  002c 1100             BCLR  0,_PTB
  002e          L2E:    
  164:  	#endif
  165:  	#ifdef QL4EVB								  // LED inverse logic
  166:      if (LEDs & 0x08) PTB_PTB0 = 0; else PTB_PTB0 = 1; 
  167:  	#endif
  168:      if (LEDs & 0x10) PTB_PTB1 = 1; else PTB_PTB1 = 0; 
  002e a510             BIT   #16
  0030 2703             BEQ   L35 ;abs = 0035
  0032 1200             BSET  1,_PTB
  0034 65               SKIP2 L37 ;abs = 0037
  0035          L35:    
  0035 1300             BCLR  1,_PTB
  0037          L37:    
  169:      if (LEDs & 0x20) PTB_PTB2 = 1; else PTB_PTB2 = 0; 
  0037 a520             BIT   #32
  0039 2703             BEQ   L3E ;abs = 003e
  003b 1400             BSET  2,_PTB
  003d 65               SKIP2 L40 ;abs = 0040
  003e          L3E:    
  003e 1500             BCLR  2,_PTB
  0040          L40:    
  170:      if (LEDs & 0x40) PTB_PTB6 = 1; else PTB_PTB6 = 0; 
  0040 a540             BIT   #64
  0042 2703             BEQ   L47 ;abs = 0047
  0044 1c00             BSET  6,_PTB
  0046 81               RTS   
  0047          L47:    
  0047 1d00             BCLR  6,_PTB
  171:  	}        
  0049 81               RTS   
  172:  
  173:  /******************************************************************************
  174:  *    Function name: init_hardware                                             *
  175:  *    Originator:                                                              *
  176:  *    Date:                                                                    *
  177:  *    Function:                                                                *
  178:  ******************************************************************************/
  179:  void init_hardware(void) 
  180:  	{

Function: init_hardware
Source  : D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\slave.c
Options : -Cc -DCW08 -Env"GENPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\cmd;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\src;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\src;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\inc;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\HC08;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -EnvOBJPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -EnvTEXTPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -F2 -Lasm=%n.lst -N -ObjN=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\LINQL4-C_Data\LIN08QL4_slave\ObjectCode\slave.c.o -Or -Pe -WmsgSd1106

  181:  	OSCTRIM = Optional;		// Pull TRIM from FFC0	
  0000 c60000           LDA   _Optional
  0003 b700             STA   _OSCTRIM
  182:  	}
  0005 81               RTS   
  183:  
  184:  /******************************************************************************
  185:  *                                                                             *
  186:  *    Function name: Read_button                                               *
  187:  *    Originator:    P. Topping                                                *
  188:  *    Date:          21st June 2003                                            *
  189:  *    Function:      The port line is read and its level compared with what    *
  190:  *                   it was the previous time through the loop. If it is the   *
  191:  *                   same, the counter "keycount" is used for debounce (80ms)  *
  192:  *                   and to decide if the same state has been present long     *
  193:  *                   enough (3 seconds) for a mode change. In each mode the    *
  194:  *                   appropriate increment (data or ID) takes place.           *
  195:  *                   If the switch status changes the counter is reset.        *
  196:  *                                                                             *
  197:  ******************************************************************************/
  198:  void Read_button (unsigned char key)
  199:  	{

Function: Read_button
Source  : D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\slave.c
Options : -Cc -DCW08 -Env"GENPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\cmd;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\src;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\src;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\inc;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\HC08;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -EnvOBJPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -EnvTEXTPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -F2 -Lasm=%n.lst -N -ObjN=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\LINQL4-C_Data\LIN08QL4_slave\ObjectCode\slave.c.o -Or -Pe -WmsgSd1106

  200:      if (key == key_last)                          // same as last time ?
  0000 c10000           CMP   key_last
  0003 266f             BNE   L74 ;abs = 0074
  201:      	{
  202:          if (keycount == debounce)                 // yes, (debounce + 2)th ?
  0005 ce0001           LDX   keycount:1
  0008 a301             CPX   #1
  000a 263c             BNE   L48 ;abs = 0048
  000c ce0000           LDX   keycount
  000f 2637             BNE   L48 ;abs = 0048
  203:          	{
  204:              if (key == 0)                         // yes, key pressed ?
  0011 4d               TSTA  
  0012 262a             BNE   L3E ;abs = 003e
  205:              	{
  206:                  if (mode)                         // yes, ID mode ?
  0014 ce0000           LDX   mode
  0017 2711             BEQ   L2A ;abs = 002a
  207:                  	{
  208:                      ID++;                         // yes, increment ID
  0019 450000           LDHX  @ID
  001c 7c               INC   ,X
  209:                      if (ID == 4) ID = 0;          // wrap round from 3 to 0
  001d ce0000           LDX   ID
  0020 a304             CPX   #4
  0022 2616             BNE   L3A ;abs = 003a
  0024 5f               CLRX  
  0025 cf0000           STX   ID
  0028 2010             BRA   L3A ;abs = 003a
  002a          L2A:    
  210:                  	}
  211:                  else                              // no, normal mode
  212:                  	{
  213:                      data++;                       // increment data
  002a 450000           LDHX  @data
  002d 7c               INC   ,X
  214:                      if (data == 16) data = 1;     // wrapping from 15 to 1
  002e ce0000           LDX   data
  0031 a310             CPX   #16
  0033 2605             BNE   L3A ;abs = 003a
  0035 ae01             LDX   #1
  0037 cf0000           STX   data
  003a          L3A:    
  215:                  	}
  216:  
  217:  				LINSleep=0;						  // Clear LINSleep flag
  003a 5f               CLRX  
  003b cf0000           STX   LINSleep
  003e          L3E:    
  218:  												  // on button press
  219:              	}
  220:              keycount ++;                          // prevents re-entry
  003e 450000           LDHX  @keycount
  0041 6c01             INC   1,X
  0043 2618             BNE   L5D ;abs = 005d
  0045 7c               INC   ,X
  221:          	}
  0046 2015             BRA   L5D ;abs = 005d
  0048          L48:    
  222:          else if (keycount < modecount)            // prevents wraparound
  0048 ce0000           LDX   keycount
  004b 89               PSHX  
  004c 8a               PULH  
  004d ce0001           LDX   keycount:1
  0050 650091           CPHX  #145
  0053 9008             BGE   L5D ;abs = 005d
  223:          	{
  224:              keycount ++;
  0055 450000           LDHX  @keycount
  0058 6c01             INC   1,X
  005a 2601             BNE   L5D ;abs = 005d
  005c 7c               INC   ,X
  005d          L5D:    
  225:          	}
  226:          if (keycount == modecount)                // time for modechange ?
  005d ce0001           LDX   keycount:1
  0060 a391             CPX   #-111
  0062 261a             BNE   L7E ;abs = 007e
  0064 ce0000           LDX   keycount
  0067 2615             BNE   L7E ;abs = 007e
  227:          	{
  228:              if (key == 0)                         // yes, key pressed ?
  0069 4d               TSTA  
  006a 2603             BNE   L6F ;abs = 006f
  229:              	{
  230:                  mode = 1;                         // yes, change to ID mode
  006c a601             LDA   #1
  231:              	}
  006e 21               SKIP1 L70 ;abs = 0070
  006f          L6F:    
  232:              else                                  // no key pressed
  233:              	{
  234:                  mode = 0;                         // so back to normal mode
  006f 4f               CLRA  
  0070          L70:    
  0070 c70000           STA   mode
  0073 81               RTS   
  0074          L74:    
  235:              	}
  236:          	}
  237:      	}
  238:      else
  239:      	{   
  240:          keycount = 0;                             // no, different, so reset 
  0074 5f               CLRX  
  0075 cf0001           STX   keycount:1
  0078 cf0000           STX   keycount
  241:          key_last = key;                           // count and save status 
  007b c70000           STA   key_last
  007e          L7E:    
  242:      	}
  243:  	}
  007e 81               RTS   
  244:  
  245:  /******************************************************************************
  246:  *    Function name: Check_LIN_Sleep                                           *
  247:  *    Originator:    Matt Ruff                                                 *
  248:  *    Date:          10 Nov 2003                                               *
  249:  *    Function:      This function checks the LINSleep flag and turns off      *
  250:  * 					the LED display when LINSleep is set. If LINSleep is clear*
  251:  *					then it allows LED_Display to turns LEDs back on again    *
  252:  ******************************************************************************/
  253:  void Check_LIN_Sleep(void)
  254:  	{

Function: Check_LIN_Sleep
Source  : D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\slave.c
Options : -Cc -DCW08 -Env"GENPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\cmd;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\src;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\src;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\inc;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\HC08;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -EnvOBJPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -EnvTEXTPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -F2 -Lasm=%n.lst -N -ObjN=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\LINQL4-C_Data\LIN08QL4_slave\ObjectCode\slave.c.o -Or -Pe -WmsgSd1106

  255:  	if (LINSleep==1)
  0000 c60000           LDA   LINSleep
  0003 4b11             DBNZA L16 ;abs = 0016
  256:  		{
  257:  		#ifdef QL4LINKit			// Turn off LEDS to indicate SLEEP to user
  258:  			PTB_PTB0 = 0;			// D8 -- LED outputs
  0005 1100             BCLR  0,_PTB
  259:  			PTB_PTB1 = 0;			// D7
  0007 1300             BCLR  1,_PTB
  260:  			PTB_PTB2 = 0;   		// D6
  0009 1500             BCLR  2,_PTB
  261:  			PTB_PTB6 = 0;			// D5
  000b 1d00             BCLR  6,_PTB
  262:  			DDRB_DDRB0 = 0;			// D8 -- Set as inputs so LED display doesn't update
  000d 1100             BCLR  0,_DDRB
  263:  			DDRB_DDRB1 = 0;			// D7
  000f 1300             BCLR  1,_DDRB
  264:  			DDRB_DDRB2 = 0;			// D6
  0011 1500             BCLR  2,_DDRB
  265:  			DDRB_DDRB6 = 0;			// D5
  0013 1d00             BCLR  6,_DDRB
  266:  		#endif
  267:  		#ifdef QL4EVB				// Turn off LEDS to indicate SLEEP to user
  268:  			PTB_PTB0 = 1;			// D1 - LED Inverse logic -- LED outputs
  269:  			PTB_PTB1 = 0;			// NC
  270:  			PTB_PTB2 = 0;   		// NC
  271:  			PTB_PTB6 = 0;			// NC
  272:  			DDRB_DDRB0 = 0;			// D1 -- Set as inputs so LED display doesn't update
  273:  			DDRB_DDRB1 = 0;			// NC
  274:  			DDRB_DDRB2 = 0;			// NC
  275:  			DDRB_DDRB6 = 0;			// NC
  276:  		#endif
  277:  		}
  0015 81               RTS   
  0016          L16:    
  278:  	else							// LINSleep is clear, so enable LED outputs
  279:  		{
  280:  		#ifdef QL4LINKit			// Initialize IO pins for LED display and button reads
  281:  			DDRB_DDRB0 = 1;			// D8 -- Set pins as outputs
  0016 1000             BSET  0,_DDRB
  282:  			DDRB_DDRB1 = 1;			// D7
  0018 1200             BSET  1,_DDRB
  283:  			DDRB_DDRB2 = 1;			// D6
  001a 1400             BSET  2,_DDRB
  284:  			DDRB_DDRB6 = 1;			// D5
  001c 1c00             BSET  6,_DDRB
  285:  		#endif
  286:  		#ifdef QL4EVB				// Initialize IO pins for LED display and button reads
  287:  			DDRB_DDRB0 = 1;			// D1 -- Set pins as outputs
  288:  			DDRB_DDRB1 = 1;			// NC
  289:  			DDRB_DDRB2 = 1;			// NC
  290:  			DDRB_DDRB6 = 1;			// NC
  291:  		#endif
  292:  		}
  293:  
  294:  	}
  001e 81               RTS   
  295:  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -