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

📄 pt100.lst

📁 原创
💻 LST
📖 第 1 页 / 共 5 页
字号:
    0424 24CC      CLR	R12
    0425 C00C      RJMP	0x0432
(0270) 	{
(0271) 	 	TempDelay ();													
    0426 DFE7      RCALL	_TempDelay
(0272) 		if(RSO)
    0427 9BC9      SBIS	0x19,1
    0428 C003      RJMP	0x042C
(0273) 			tmp|=1;
    0429 01C5      MOVW	R24,R10
    042A 6081      ORI	R24,1
    042B 015C      MOVW	R10,R24
(0274) 		SETSCK;
    042C 9ADA      SBI	0x1B,2
(0275) 		tmp<<=1;
    042D 0CAA      LSL	R10
    042E 1CBB      ROL	R11
(0276) 	 	TempDelay ();
    042F DFDE      RCALL	_TempDelay
(0277) 		CLRSCK;
    0430 98DA      CBI	0x1B,2
    0431 94C3      INC	R12
    0432 2D8C      MOV	R24,R12
    0433 308F      CPI	R24,0xF
    0434 F388      BCS	0x0426
(0278) 	}
(0279) 	return(tmp>>2);
    0435 0185      MOVW	R16,R10
    0436 9516      LSR	R17
    0437 9507      ROR	R16
    0438 9516      LSR	R17
    0439 9507      ROR	R16
    043A 940E089A  CALL	pop_gset4x
    043C 9508      RET
(0280) }
(0281) 
(0282) 
(0283) 
(0284) /*************************************************************************************************************
(0285) *	函数名称 :TempInit
(0286) *	功能描述 :初始化6675
(0287) *	实际参数 :
(0288) *	返回值   :
(0289) *	说明     :
(0290) *************************************************************************************************************/
(0291) void TempInit (void){
(0292) 	 DDRA|= 0x04;	   //TSCK
_TempInit:
    043D 9AD2      SBI	0x1A,2
(0293) 	 DDRA&=~0x02;	   //TMISO
    043E 98D1      CBI	0x1A,1
(0294) 
(0295) 	 TempCs(0);        //CS = 0,Enable 6675
    043F 2700      CLR	R16
    0440 DE84      RCALL	_TempCs
(0296) 	  																																	  
(0297) 	 TempRead6675Dat();//进行第一次哑转换
    0441 DFDD      RCALL	_TempRead6675Dat
(0298) 
(0299) 	 TempCs(1);        //CS = 0,Disable 6675	 
    0442 E001      LDI	R16,1
    0443 DE81      RCALL	_TempCs
    0444 9508      RET
FILE: E:\avrwork3_pt100\main.c
(0001) //ICC-AVR application builder : 2007-8-14 17:19:54
(0002) // Target : M16         0x59EF   0xD9DF
(0003) // Crystal: 11.059Mhz
(0004) 
(0005) #include <iom16v.h>
(0006) #include <macros.h>
(0007) #include "hal.h"
(0008) #include "main.h"
(0009) #include "uart.h"
(0010) #include "Temp.h"
(0011) 
(0012) 
(0013) //AD值转换成客户值的函数
(0014) 
(0015) const unsigned int PT100_TAB[410]={
(0016)  10000, 10039, 10078, 10117, 10156, 10195, 10234, 10273, 10313, 10351,//0
(0017)  10390, 10429, 10468, 10507, 10546, 10585, 10624, 10663, 10702, 10740,//10
(0018)  10779, 10818, 10857, 10896, 10935, 10973, 11012, 11051, 11090, 11128,//20
(0019)  11167, 11206, 11245, 11283, 11322, 11361, 11399, 11438, 11477, 11515,//30
(0020)  11554, 11593, 11631, 11670, 11708, 11747, 11785, 11824, 11862, 11901,//40
(0021)  11940, 11978, 12016, 12055, 12093, 12132, 12170, 12209, 12247, 12286,//50
(0022)  12324, 12362, 12401, 12439, 12477, 12516, 12554, 12592, 12631, 12669,//60
(0023)  12707, 12745, 12784, 12822, 12860, 12898, 12937, 12975, 13013, 13051,//70
(0024)  13089, 13127, 13166, 13204, 13242, 13280, 13318, 13356, 13394, 13432,//80
(0025)  13470, 13508, 13546, 13584, 13622, 13660, 13698, 13736, 13774, 13812,//90
(0026)  13850, 13888, 13926, 13964, 14002, 14039, 14077, 14115, 14153, 14191,//100
(0027)  14229, 14266, 14304, 14342, 14380, 14417, 14455, 14493, 14531, 14568,//110
(0028)  14606, 14644, 14681, 14719, 14757, 14794, 14832, 14870, 14907, 14945,//120
(0029)  14982, 15020, 15057, 15095, 15133, 15170, 15208, 15245, 15283, 15320,//130
(0030)  15358, 15395, 15432, 15470, 15507, 15545, 15582, 15619, 15657, 15694,//140
(0031)  15731, 15769, 15806, 15843, 15881, 15918, 15955, 15993, 16030, 16067,//150
(0032)  16104, 16142, 16179, 16216, 16253, 16290, 16327, 16365, 16402, 16439,//160
(0033)  16476, 16513, 16550, 16587, 16624, 16661, 16698, 16735, 16772, 16809,//170
(0034)  16846, 16883, 16920, 16957, 16994, 17031, 17068, 17105, 17142, 17179,//180
(0035)  17216, 17253, 17290, 17326, 17363, 17400, 17437, 17474, 17510, 17547,//190
(0036)  17584, 17621, 17657, 17694, 17731, 17768, 17804, 17841, 17878, 17914,//200
(0037)  17951, 17988, 18024, 18061, 18097, 18134, 18171, 18207, 18244, 18280,//210
(0038)  18317, 18353, 18390, 18426, 18463, 18499, 18536, 18572, 18609, 18645,//220
(0039)  18682, 18718, 18754, 18791, 18827, 18863, 18900, 18936, 18972, 19009,//230
(0040)  19045, 19081, 19118, 19154, 19190, 19226, 19263, 19299, 19335, 19371,//240
(0041)  19407, 19444, 19480, 19516, 19552, 19588, 19624, 19660, 19696, 19733,//250
(0042)  19769, 19805, 19841, 19877, 19913, 19949, 19985, 20021, 20057, 20093,//260
(0043)  20129, 20165, 20201, 20236, 20272, 20308, 20344, 20380, 20416, 20452,//270
(0044)  20488, 20523, 20559, 20595, 20631, 20667, 20702, 20738, 20774, 20810,//280
(0045)  20845, 20881, 20917, 20952, 20988, 21024, 21059, 21095, 21131, 21166,//290
(0046)  21202, 21237, 21273, 21309, 21344, 21380, 21415, 21451, 21486, 21522,//300
(0047)  21557, 21593, 21628, 21664, 21699, 21735, 21770, 21805, 21841, 21876,//310
(0048)  21912, 21947, 21982, 22018, 22053, 22088, 22124, 22159, 22194, 22229,//320
(0049)  22265, 22300, 22335, 22370, 22406, 22441, 22476, 22511, 22546, 22581,//330
(0050)  22617, 22652, 22687, 22722, 22557, 22792, 22827, 22862, 22897, 22932,//340
(0051)  22967, 23002, 23037, 23072, 23107, 23142, 23177, 23212, 23247, 23282,//350
(0052)  23317, 23352, 23387, 23422, 23456, 23491, 23526, 23561, 23596, 23631,//360
(0053)  23665, 23700, 23735, 23770, 23804, 23839, 23874, 23909, 23943, 23978,//370
(0054)  24013, 24047, 24082, 24117, 24151, 24186, 24220, 24255, 24290, 24324,//380
(0055)  24359, 24393, 24428, 24462, 24497, 24531, 24566, 24600, 24635, 24669,//390
(0056)  24704, 24738, 24773, 24807, 24841, 24876, 24910, 24945, 24979, 25013,//400
(0057) };    
(0058)  
(0059)  
(0060)  
(0061) uint8 sendpro=0;   	  //时间保护计数器
(0062) uint8 test_byte=0;    //测试通信
(0063) uint8 sendpro_bk;     //时间保护计数器的后备
(0064)  
(0065) uint8 t_send_flag = 0;			  //A250用到
(0066) uint8 rece_complete_flag = 0;     //A250用到 
(0067)  
(0068) uint16 T10_send[MAX_SEND]={0};    //发送缓冲
(0069) uint16 T10_read[MAX_RECE]={0,0,0,0,0,0,0,0,0,0,15,5};    //接收缓冲
(0070) 
(0071) uint8 receFCom[6]={0};            //解包缓冲
(0072) uint8 receDComCount = 0;          //解包计数器
(0073) 
(0074) uint8 testFlag = 0;
(0075) 
(0076) //包头的特殊码表
(0077) const uint8 receNFtab[62] = {0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,
(0078) 	                         0x0f,0x1f,0x2f,0x3f,0x4f,0x5f,0x6f,0x7f,0x8f,0x9f,
(0079) 					         0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,
(0080) 	                         0x0e,0x1e,0x2e,0x3e,0x4e,0x5e,0x6e,0x7e,0x8e,0x9e,
(0081) 					         0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,
(0082) 	                         0x0c,0x1c,0x2c,0x3c,0x4c,0x5c,0x6c,0x7c,0x8c,0x9c,
(0083) 					         0xd0,0xd1												  	 
(0084) };
(0085) 
(0086) 
(0087) 
(0088) void port_init(void)
(0089) {
(0090)  PORTA = 0xe0;
_port_init:
    0445 EE80      LDI	R24,0xE0
    0446 BB8B      OUT	0x1B,R24
(0091)  DDRA  = 0x18;
    0447 E188      LDI	R24,0x18
    0448 BB8A      OUT	0x1A,R24
(0092)  PORTB = 0x00;
    0449 2422      CLR	R2
    044A BA28      OUT	0x18,R2
(0093)  DDRB  = 0xFF;
    044B EF8F      LDI	R24,0xFF
    044C BB87      OUT	0x17,R24
(0094)  PORTD = 0x80;
    044D E880      LDI	R24,0x80
    044E BB82      OUT	0x12,R24
(0095)  DDRD  = 0xfA;
    044F EF8A      LDI	R24,0xFA
    0450 BB81      OUT	0x11,R24
(0096)  U7(0xff);
    0451 EF0F      LDI	R16,0xFF
    0452 940E0299  CALL	_U7
(0097)  U9(0xff);
    0454 EF0F      LDI	R16,0xFF
    0455 940E02AF  CALL	_U9
(0098)  U18(0xff);
    0457 EF0F      LDI	R16,0xFF
    0458 940E02A4  CALL	_U18
(0099)  U19(0xff);
    045A EF0F      LDI	R16,0xFF
    045B 940E02BA  CALL	_U19
(0100)  PORTD = 0x00; 
    045D 2422      CLR	R2
    045E BA22      OUT	0x12,R2
(0101)  DDRC = 0b10011111;
    045F E98F      LDI	R24,0x9F
    0460 BB84      OUT	0x14,R24
(0102)  PORTC= 0b11111111;
    0461 EF8F      LDI	R24,0xFF
    0462 BB85      OUT	0x15,R24
    0463 9508      RET
(0103) }
(0104) 
(0105) //TIMER1 initialize - prescale:64
(0106) // WGM: 4) CTC, TOP=OCRnA
(0107) // desired value: 100mSec
(0108) // actual value: 99.996mSec (0.0%)
(0109) void timer1_init(void)
(0110) {
(0111)  TCCR1B = 0x00; //stop
_timer1_init:
    0464 2422      CLR	R2
    0465 BC2E      OUT	0x2E,R2
(0112)  TCNT1H = 0xBC; //setup
    0466 EB8C      LDI	R24,0xBC
    0467 BD8D      OUT	0x2D,R24
(0113)  TCNT1L = 0x82;
    0468 E882      LDI	R24,0x82
    0469 BD8C      OUT	0x2C,R24
(0114)  OCR1AH = 0x43;
    046A E483      LDI	R24,0x43
    046B BD8B      OUT	0x2B,R24
(0115)  OCR1AL = 0x7E;
    046C E78E      LDI	R24,0x7E
    046D BD8A      OUT	0x2A,R24
(0116)  OCR1BH = 0x43;
    046E E483      LDI	R24,0x43
    046F BD89      OUT	0x29,R24
(0117)  OCR1BL = 0x7E;
    0470 E78E      LDI	R24,0x7E
    0471 BD88      OUT	0x28,R24
(0118)  ICR1H  = 0x43;
    0472 E483      LDI	R24,0x43
    0473 BD87      OUT	0x27,R24
(0119)  ICR1L  = 0x7E;
    0474 E78E      LDI	R24,0x7E
    0475 BD86      OUT	0x26,R24
(0120)  TCCR1A = 0x00;
    0476 BC2F      OUT	0x2F,R2
(0121)  TCCR1B = 0x0B; //start Timer
    0477 E08B      LDI	R24,0xB
    0478 BD8E      OUT	0x2E,R24
    0479 9508      RET
(0122) }
(0123) 
(0124) //TIMER0 initialize - prescale:64
(0125) // WGM: Normal
(0126) // desired value: 1mSec
(0127) // actual value:  0.995mSec (0.5%)
(0128) void timer0_init(void)
(0129) {
(0130)  TCCR0 = 0x00; //stop
_timer0_init:
    047A 2422      CLR	R2
    047B BE23      OUT	0x33,R2
(0131)  TCNT0 = 0x54; //set count
    047C E584      LDI	R24,0x54
    047D BF82      OUT	0x32,R24
(0132)  OCR0  = 0xAC;  //set compare
    047E EA8C      LDI	R24,0xAC
    047F BF8C      OUT	0x3C,R24
(0133)  TCCR0 = 0x03; //start timer
    0480 E083      LDI	R24,3
    0481 BF83      OUT	0x33,R24
    0482 9508      RET
_timer0_ovf_isr:
    0483 922A      ST	R2,-Y
    0484 938A      ST	R24,-Y
    0485 939A      ST	R25,-Y
    0486 B62F      IN	R2,0x3F
    0487 922A      ST	R2,-Y
(0134) }
(0135) 
(0136) #pragma interrupt_handler timer0_ovf_isr:10
(0137) void timer0_ovf_isr(void)
(0138) {
(0139)  static uint8 a=0;
(0140)  TCNT0 = 0x54; //reload counter value
    0488 E584      LDI	R24,0x54
    0489 BF82      OUT	0x32,R24
(0141)  sendpro++;
    048A 91800064  LDS	R24,sendpro
    048C 5F8F      SUBI	R24,0xFF
    048D 93800064  STS	sendpro,R24
(0142)  
(0143)  a++;
    048F 918000D8  LDS	R24,a
    0491 5F8F      SUBI	R24,0xFF
    0492 938000D8  STS	a,R24
(0144)  if(25==a){
    0494 3189      CPI	R24,0x19
    0495 F431      BNE	0x049C
(0145)    a=0;
    0496 2422      CLR	R2
    0497 922000D8  STS	a,R2
(0146)    t_send_flag = 1;                                   //发送周期
    0499 E081      LDI	R24,1
    049A 93800066  STS	t_send_flag,R24
(0147)  }
    049C 9029      LD	R2,Y+
    049D BE2F      OUT	0x3F,R2
    049E 9199      LD	R25,Y+
    049F 9189      LD	R24,Y+
    04A0 9029      LD	R2,Y+
    04A1 9518      RETI
_time1_compa_isr:
    04A2 922A      ST	R2,-Y
    04A3 938A      ST	R24,-Y
    04A4 939A      ST	R25,-Y
    04A5 B62F      IN	R2,0x3F
    04A6 922A      ST	R2,-Y
(0148) 
(0149) }
(0150) 
(0151) 
(0152) #pragma interrupt_handler time1_compa_isr:7
(0153) void time1_compa_isr(void)
(0154) {
(0155) //  Time_Int++;			  				   			  //温度0.1秒的标志
(0156)   PORTA^=0x10;                                        //LED闪烁
    04A7 E180      LDI	R24,0x10
    04A8 B22B      IN	R2,0x1B
    04A9 2628      EOR	R2,R24
    04AA BA2B      OUT	0x1B,R2
(0157)   testFlag++;
    04AB 918000D7  LDS	R24,testFlag
    04AD 5F8F      SUBI	R24,0xFF
    04AE 938000D7  STS	testFlag,R24
    04B0 9029      LD	R2,Y+
    04B1 BE2F      OUT	0x3F,R2
    04B2 9199      LD	R25,Y+
    04B3 9189      LD	R24,Y+
    04B4 9029      LD	R2,Y+
    04B5 9518      RETI
(0158) }
(0159) 
(0160) #pragma interrupt_handler int0_isr:2
(0161) void int0_isr(void)
(0162) {
_int0_isr:
    04B6 9518      RETI
(0163)  
(0164) }
(0165) 
(0166) 
(0167) #pragma interrupt_handler adc_isr:15
(0168) void adc_isr(void)
(0169) {
_adc_isr:
    04B7 9518      RETI
(0170)  //conversion complete, read value (int) using...
(0171)  // value=ADCL;            //Read 8 low bits first (important)
(0172)  // value|=(int)ADCH << 8; //read 2 high bits and shift into top byte
(0173) }
(0174) 
(0175) //ADC initialize
(0176) // Conversion time: 150uS
(0177) void adc_init(void)
(0178) {
(0179)  ADCSR = 0x00; //disable adc
_adc_init:
    04B8 2422      CLR	R2
    04B9 B826      OUT	0x06,R2
(0180)  ADMUX = 0xc0; //select adc input 0
    04BA EC80      LDI	R24,0xC0
    04BB B987      OUT	0x07,R24
(0181) // ACSR  = 0x80;
(0182)  ADCSRA = 0x87;
    04BC E887      LDI	R24,0x87
    04BD B986      OUT	0x06,R24
    04BE 9508      RET
(0183) }
(0184) 
(0185) //call this routine to initialize all peripherals
(0186) void init_devices(void)
(0187) {
(0188)  //stop errant interrupts until set up
(0189)  CLI(); //disable all interrupts
_init_devices:
    04BF 94F8      BCLR	7
(0190)  port_init();
    04C0 DF84      RCALL	_port_init
(0191)  timer0_init();
    04C1 DFB8      RCALL	_timer0_init
(0192)  timer1_init();
    04C2 DFA1      RCALL	_timer1_init
(0193)  InitUART( 71 ); 
    04C3 E407      LDI	R16,0x47
    04C4 940E0726  CALL	_InitUART
(0194)  TempInit();
    04C6 940E043D  CALL	_TempInit
(0195)  adc_init();
    04C8 DFEF      RCALL	_adc_init
(0196)  
(0197)  MCUCR = 0x02;
    04C9 E082      LDI	R24,2
    04CA BF85      OUT	0x35,R24
(0198)  GICR  = 0x00;
    04CB 2422      CLR	R2
    04CC BE2B      OUT	0x3B,R2
(0199)  TIMSK = 0x11; //timer interrupt sources
    04CD E181      LDI	R24,0x11
    04CE BF89      OUT	0x39,R24
(0200)  SEI(); //re-enable interrupts
    04CF 9478      BSET	7
    04D0 9508      RET
(0201)  //all peripherals are now initialized
(0202) 
(0203) 
(0204)    
(0205) 
(0206)  
(0207) 
(0208) }

⌨️ 快捷键说明

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