?? dh980_icc.lst
字號:
(0129) CLR_CS ; //PE3
(0130) SET_SCK; //PE6
(0131) CLR_SCK ; //PE6
(0132) SET_SDI; //PE4
(0133) CLR_SDI; //PE4
(0134) SET_SDO; //PE5
(0135) CLR_SDO ; //PE5
(0136) SDO ; //PE5 */
(0137) //LTC2449_init();
(0138) Init5532();
01B6 940E03AE CALL _Init5532
(0139) relay_init();
01B8 940E021C CALL _relay_init
(0140) load_init();
01BA 940E0694 CALL _load_init
(0141) updating=0;
01BC 2422 CLR R2
01BD 92200207 STS updating,R2
01BF C016 RJMP 0x01D6
(0142) while(1)
(0143) {
(0144) //主程序循環定時
(0145) while(mcu_loop_time<20){;}
01C0 91800230 LDS R24,mcu_loop_time
01C2 3184 CPI R24,0x14
01C3 F3E0 BCS 0x01C0
(0146) mcu_loop_time=0;
01C4 2422 CLR R2
01C5 92200230 STS mcu_loop_time,R2
(0147) data_load_manage();
01C7 940E06A3 CALL _data_load_manage
(0148) if(updating==1)
01C9 91800207 LDS R24,updating
01CB 3081 CPI R24,1
01CC F431 BNE 0x01D3
(0149) {
(0150) //**********繼電器刷新****************
(0151) RELAY_out(&(Down_load.Relay_out[0]));
01CD E002 LDI R16,2
01CE E012 LDI R17,2
01CF 940E023D CALL _RELAY_out
(0152) //*********上傳數據********************
(0153) data_send();
01D1 940E06FD CALL _data_send
(0154) }
(0155) pb_check();
01D3 DFCF RCALL _pb_check
(0156) AD_sample();
01D4 940E03F2 CALL _AD_sample
01D6 CFE9 RJMP 0x01C0
01D7 9508 RET
FILE: E:\mysoft\DH980\LTC2449.c
(0001) #define _LTC2449_C
(0002) #include <iom169v.h>
(0003) #include <macros.h>
(0004) #include <stdio.h>
(0005) #include "LTC2449.h"
(0006) #include "main.h"
(0007)
(0008) void LTC2449_init()
(0009) {
(0010) SET_CS;
_LTC2449_init:
01D8 9A73 SBI 0x0E,3
(0011) CLR_SCK;
01D9 B18E IN R24,0x0E
01DA 7E8F ANDI R24,0xEF
01DB B98E OUT 0x0E,R24
(0012) CLR_CS;
01DC B18E IN R24,0x0E
01DD 7F87 ANDI R24,0xF7
01DE B98E OUT 0x0E,R24
01DF 9508 RET
_LTC2449_RW:
setup --> R20
AD_data --> R22
l --> R10
chunnel --> R16
01E0 940E07A6 CALL push_gset3
(0013) }
(0014) unsigned long LTC2449_RW(unsigned int chunnel)
(0015) {
(0016) unsigned char l;
(0017) unsigned int AD_data=0;
01E2 2766 CLR R22
01E3 2777 CLR R23
(0018) unsigned int setup=0xa050;
01E4 E540 LDI R20,0x50
01E5 EA50 LDI R21,0xA0
(0019) CLR_CS;
01E6 B18E IN R24,0x0E
01E7 7F87 ANDI R24,0xF7
01E8 B98E OUT 0x0E,R24
(0020) chunnel=chunnel<<8;chunnel&=0b0000011100000000;
01E9 2F10 MOV R17,R16
01EA 2700 CLR R16
01EB 7000 ANDI R16,0
01EC 7017 ANDI R17,7
(0021) setup|=chunnel;
01ED 2B40 OR R20,R16
01EE 2B51 OR R21,R17
(0022) while(SDO!=0)
01EF 9965 SBIC 0x0C,5
01F0 CFFE RJMP 0x01EF
(0023) {;}
(0024) for(l=0;l<32;l++)
01F1 24AA CLR R10
01F2 C01E RJMP 0x0211
(0025) {
(0026) if(l<13)
01F3 2D8A MOV R24,R10
01F4 308D CPI R24,0xD
01F5 F448 BCC 0x01FF
(0027) {
(0028) if((setup&0x8000)!=0)
01F6 FF57 SBRS R21,7
01F7 C002 RJMP 0x01FA
(0029) SET_SDI;
01F8 9A76 SBI 0x0E,6
01F9 C003 RJMP 0x01FD
(0030) else
(0031) CLR_SDI;
01FA B18E IN R24,0x0E
01FB 7B8F ANDI R24,0xBF
01FC B98E OUT 0x0E,R24
(0032) setup=setup<<1;
01FD 0F44 LSL R20
01FE 1F55 ROL R21
(0033) }
(0034) SET_SCK;
01FF 9A74 SBI 0x0E,4
(0035) if(l>2 && l<19)//取最高16位
0200 E082 LDI R24,2
0201 158A CP R24,R10
0202 F450 BCC 0x020D
0203 2D8A MOV R24,R10
0204 3183 CPI R24,0x13
0205 F438 BCC 0x020D
(0036) {
(0037) AD_data=AD_data<<1;
0206 0F66 LSL R22
0207 1F77 ROL R23
(0038) if(SDO!=0)
0208 9B65 SBIS 0x0C,5
0209 C002 RJMP 0x020C
(0039) AD_data|=0x0001;
020A 6061 ORI R22,1
020B C001 RJMP 0x020D
(0040) else
(0041) AD_data&=0xfffe;
020C 7F6E ANDI R22,0xFE
(0042) }
(0043) CLR_SCK;
020D B18E IN R24,0x0E
020E 7E8F ANDI R24,0xEF
020F B98E OUT 0x0E,R24
0210 94A3 INC R10
0211 2D8A MOV R24,R10
0212 3280 CPI R24,0x20
0213 F2F8 BCS 0x01F3
(0044) }
(0045) //SET_CS;
(0046) return AD_data;
0214 011B MOVW R2,R22
0215 2444 CLR R4
0216 2455 CLR R5
0217 0181 MOVW R16,R2
0218 0192 MOVW R18,R4
0219 940E0799 CALL pop_gset3
021B 9508 RET
FILE: E:\mysoft\DH980\relay_out.c
(0001) #include <iom169v.h>
(0002) #include <macros.h>
(0003) #include <stdio.h>
(0004) #include "main.h"
(0005)
(0006) #define RELAY1_0 PORTF|=0b00000001 //PF0
(0007) #define RELAY1_1 PORTF&=0b11111110 //PF0
(0008) #define RELAY2_0 PORTF|=0b00000010 //PF1
(0009) #define RELAY2_1 PORTF&=0b11111101 //PF1
(0010) #define RELAY3_0 PORTF|=0b00000100 //PF2
(0011) #define RELAY3_1 PORTF&=0b11111011 //PF2
(0012) #define RELAY4_0 PORTF|=0b00001000 //PF3
(0013) #define RELAY4_1 PORTF&=0b11110111 //PF3
(0014) #define RELAY5_0 PORTA|=0b00000001 //PA0
(0015) #define RELAY5_1 PORTA&=0b11111110 //PA0
(0016) #define RELAY6_0 PORTA|=0b00000010 //PA1
(0017) #define RELAY6_1 PORTA&=0b11111101 //PA1
(0018) #define RELAY7_0 PORTA|=0b00000100 //PA2
(0019) #define RELAY7_1 PORTA&=0b11111011 //PA2
(0020) #define RELAY8_0 PORTA|=0b00001000 //PA3
(0021) #define RELAY8_1 PORTA&=0b11110111 //PA3
(0022) #define RELAY9_0 PORTA|=0b00010000 //PA4
(0023) #define RELAY9_1 PORTA&=0b11101111 //PA4
(0024) #define RELAY10_0 PORTA|=0b00100000 //PA5
(0025) #define RELAY10_1 PORTA&=0b11011111 //PA5
(0026) #define RELAY11_0 PORTA|=0b01000000 //PA6
(0027) #define RELAY11_1 PORTA&=0b10111111 //PA6
(0028) #define RELAY12_0 PORTA|=0b10000000 //PA7
(0029) #define RELAY12_1 PORTA&=0b01111111 //PA7
(0030) #define RELAY13_0 PORTG|=0b00000100 //PG2
(0031) #define RELAY13_1 PORTG&=0b11111011 //PG2
(0032) #define RELAY14_0 PORTC|=0b10000000 //PC7
(0033) #define RELAY14_1 PORTC&=0b01111111 //PC7
(0034) #define RELAY15_0 PORTC|=0b01000000 //PC6
(0035) #define RELAY15_1 PORTC&=0b10111111 //PC6
(0036) #define RELAY16_0 PORTC|=0b00100000 //PC5
(0037) #define RELAY16_1 PORTC&=0b11011111 //PC5
(0038) #define RELAY17_0 PORTC|=0b00010000 //PC4
(0039) #define RELAY17_1 PORTC&=0b11101111 //PC4
(0040) #define RELAY18_0 PORTC|=0b00001000 //PC3
(0041) #define RELAY18_1 PORTC&=0b11110111 //PC3
(0042) #define RELAY19_0 PORTC|=0b00000100 //PC2
(0043) #define RELAY19_1 PORTC&=0b11111011 //PC2
(0044) #define RELAY20_0 PORTC|=0b00000010 //PC1
(0045) #define RELAY20_1 PORTC&=0b11111101 //PC1
(0046) #define RELAY21_0 PORTC|=0b00000001 //PC0
(0047) #define RELAY21_1 PORTC&=0b11111110 //PC0
(0048) #define RELAY22_0 PORTG|=0b00000010 //PG1
(0049) #define RELAY22_1 PORTG&=0b11111101 //PG1
(0050) #define RELAY23_0 PORTG|=0b00000001 //PG0
(0051) #define RELAY23_1 PORTG&=0b11111110 //PG0
(0052) #define RELAY24_0 PORTD|=0b10000000 //PD7
(0053) #define RELAY24_1 PORTD&=0b01111111 //PD7
(0054) #define RELAY25_0 PORTD|=0b01000000 //PD6
(0055) #define RELAY25_1 PORTD&=0b10111111 //PD6
(0056) #define RELAY26_0 PORTD|=0b00100000 //PD5
(0057) #define RELAY26_1 PORTD&=0b11011111 //PD5
(0058) #define RELAY27_0 PORTD|=0b00010000 //PD4
(0059) #define RELAY27_1 PORTD&=0b11101111 //PD4
(0060) #define RELAY28_0 PORTD|=0b00001000 //PD3
(0061) #define RELAY28_1 PORTD&=0b11110111 //PD3
(0062) #define RELAY29_0 PORTD|=0b00000100 //PD2
(0063) #define RELAY29_1 PORTD&=0b11111011 //PD2
(0064) #define RELAY30_0 PORTD|=0b00000010 //PD1
(0065) #define RELAY30_1 PORTD&=0b11111101 //PD1
(0066) #define RELAY31_0 PORTD|=0b00000001 //PD0
(0067) #define RELAY31_1 PORTD&=0b11111110 //PD0
(0068) #define RELAY32_0 PORTG|=0b00010000 //PG4
(0069) #define RELAY32_1 PORTG&=0b11101111 //PG4
(0070) void relay_init()
(0071) {
(0072) RELAY1_0;
_relay_init:
021C 9A88 SBI 0x11,0
(0073) RELAY2_0;
021D 9A89 SBI 0x11,1
(0074) RELAY3_0;
021E 9A8A SBI 0x11,2
(0075) RELAY4_0;
021F 9A8B SBI 0x11,3
(0076) RELAY5_0;
0220 9A10 SBI 0x02,0
(0077) RELAY6_0;
0221 9A11 SBI 0x02,1
(0078) RELAY7_0;
0222 9A12 SBI 0x02,2
(0079) RELAY8_0;
0223 9A13 SBI 0x02,3
(0080) RELAY9_0;
0224 9A14 SBI 0x02,4
(0081) RELAY10_0;
0225 9A15 SBI 0x02,5
(0082) RELAY11_0;
0226 9A16 SBI 0x02,6
(0083) RELAY12_0;
0227 9A17 SBI 0x02,7
(0084) RELAY13_0;
0228 9AA2 SBI 0x14,2
(0085) RELAY14_0;
0229 9A47 SBI 0x08,7
(0086) RELAY15_0;
022A 9A46 SBI 0x08,6
(0087) RELAY16_0;
022B 9A45 SBI 0x08,5
(0088) RELAY17_0;
022C 9A44 SBI 0x08,4
(0089) RELAY18_0;
022D 9A43 SBI 0x08,3
(0090) RELAY19_0;
022E 9A42 SBI 0x08,2
(0091) RELAY20_0;
022F 9A41 SBI 0x08,1
(0092) RELAY21_0;
0230 9A40 SBI 0x08,0
(0093) RELAY22_0;
0231 9AA1 SBI 0x14,1
(0094) RELAY23_0;
0232 9AA0 SBI 0x14,0
(0095) RELAY24_0;
0233 9A5F SBI 0x0B,7
(0096) RELAY25_0;
0234 9A5E SBI 0x0B,6
(0097) RELAY26_0;
0235 9A5D SBI 0x0B,5
(0098) RELAY27_0;
0236 9A5C SBI 0x0B,4
(0099) RELAY28_0;
0237 9A5B SBI 0x0B,3
(0100) RELAY29_0;
0238 9A5A SBI 0x0B,2
(0101) RELAY30_0;
0239 9A59 SBI 0x0B,1
(0102) RELAY31_0;
023A 9A58 SBI 0x0B,0
(0103) RELAY32_0;
023B 9AA4 SBI 0x14,4
023C 9508 RET
_RELAY_out:
b --> R22
n --> Y+0
l --> R12
temp --> R14
p --> Y+11
023D 931A ST R17,-Y
023E 930A ST R16,-Y
023F 940E07A2 CALL push_gset5
0241 9721 SBIW R28,1
(0104) }
(0105) void RELAY_out(unsigned char *p)
(0106) {
(0107) unsigned char b,l,n=1,temp;
0242 2400 CLR R0
0243 9403 INC R0
0244 8208 STD Y+0,R0
(0108) updating=0; //刷新后復位
0245 2422 CLR R2
0246 92200207 STS updating,R2
(0109) for(b=0;b<4;b++)
0248 2766 CLR R22
0249 C10B RJMP 0x0355
(0110) {
(0111) temp=*p;
024A 85EB LDD R30,Y+11
024B 85FC LDD R31,Y+12
024C 80E0 LDD R14,Z+0
(0112) for(l=0;l<8;l++)
024D 24CC CLR R12
024E C0FC RJMP 0x034B
(0113) {
(0114) if((temp&0b10000000)!=0)
024F FEE7 SBRS R14,7
0250 C09B RJMP 0x02EC
(0115) {
(0116) switch(n)
0251 80A8 LDD R10,Y+0
0252 24BB CLR R11
0253 01C5 MOVW R24,R10
0254 3081 CPI R24,1
0255 E0E0 LDI R30,0
0256 079E CPC R25,R30
0257 F40C BGE 0x0259
0258 C0ED RJMP 0x0346
0259 E280 LDI R24,0x20
025A 158A CP R24,R10
025B 059B CPC R25,R11
025C F40C BGE 0x025E
025D C0E8 RJMP 0x0346
025E E002 LDI R16,2
025F E010 LDI R17,0
0260 0195 MOVW R18,R10
0261 940E0786 CALL empy16s
0263 01F8 MOVW R30,R16
0264 E58A LDI R24,0x5A
0265 E090 LDI R25,0
0266 0FE8 ADD R30,R24
0267 1FF9 ADC R31,R25
0268 9005 LPM R0,Z+
0269 9014 LPM R1,0(Z)
026A 01F0 MOVW R30,R0
026B 9409 IJMP
(0117) {
(0118) case 1:RELAY1_1;break;
026C B381 IN R24,0x11
026D 7F8E ANDI R24,0xFE
026E BB81 OUT 0x11,R24
026F C0D6 RJMP 0x0346
(0119) case 2:RELAY2_1;break;
0270 B381 IN R24,0x11
0271 7F8D ANDI R24,0xFD
0272 BB81 OUT 0x11,R24
0273 C0D2 RJMP 0x0346
(0120) case 3:RELAY3_1;break;
0274 B381 IN R24,0x11
0275 7F8B ANDI R24,0xFB
0276 BB81 OUT 0x11,R24
0277 C0CE RJMP 0x0346
(0121) case 4:RELAY4_1;break;
0278 B381 IN R24,0x11
0279 7F87 ANDI R24,0xF7
027A BB81 OUT 0x11,R24
027B C0CA RJMP 0x0346
(0122) case 5:RELAY5_1;break;
027C B182 IN R24,0x02
027D 7F8E ANDI R24,0xFE
027E B982 OUT 0x02,R24
027F C0C6 RJMP 0x0346
(0123) case 6:RELAY6_1;break;
0280 B182 IN R24,0x02
0281 7F8D ANDI R24,0xFD
0282 B982 OUT 0x02,R24
0283 C0C2 RJMP 0x0346
(0124) case 7:RELAY7_1;break;
0284 B182 IN R24,0x02
0285 7F8B ANDI R24,0xFB
0286 B982 OUT 0x02,R24
0287 C0BE RJMP 0x0346
(0125) case 8:RELAY8_1;break;
0288 B182 IN R24,0x02
0289 7F87 ANDI R24,0xF7
028A B982 OUT 0x02,R24
028B C0BA RJMP 0x0346
(0126) case 9:RELAY9_1;break;
028C B182 IN R24,0x02
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -