📄 8255.lst
字号:
__start:
__text_start:
221 EFCF LDI R28,0xFF
222 E1D0 LDI R29,0x10
223 BFCD OUT 0x3D,R28
224 BFDE OUT 0x3E,R29
225 51CE SUBI R28,0x1E
226 40D0 SBCI R29,0
227 EA0A LDI R16,0xAA
228 8308 STD Y+0,R16
229 2400 CLR R0
22A E1EA LDI R30,0x1A
22B E0F1 LDI R31,1
22C E011 LDI R17,1
22D 32ED CPI R30,0x2D
22E 07F1 CPC R31,R17
22F F011 BEQ 0x0232
230 9201 ST R0,Z+
231 CFFB RJMP 0x022D
232 8300 STD Z+0,R16
233 E2E8 LDI R30,0x28
234 E0F4 LDI R31,4
235 E0A0 LDI R26,0
236 E0B1 LDI R27,1
237 E014 LDI R17,4
238 E000 LDI R16,0
239 BF0B OUT 0x3B,R16
23A 34E2 CPI R30,0x42
23B 07F1 CPC R31,R17
23C F021 BEQ 0x0241
23D 95C8 LPM
23E 9631 ADIW R30,1
23F 920D ST R0,X+
240 CFF9 RJMP 0x023A
241 940E 0F12 CALL _main
_exit:
243 CFFF RJMP _exit
_delay:
i --> R20
j --> R22
t --> R16
244 940E 21CF CALL push_xgsetF000
FILE: E:\dianyuan\ATMEGA128\ATMEGA128\8255.c
(0001) #include <iom128v.h>
(0002) #define setbit(x,y) x|=(1<<y) //将X的第Y位置1
(0003) #define clrbit(x,y) x&=~(1<<y) //将X的第Y位清0
(0004) //定义8255
(0005) #define WRON PORTC&=~(1<<0)
(0006) #define WROFF PORTC|=(1<<0)
(0007) #define A01 PORTC|=(1<<1)
(0008) #define A00 PORTC&=~(1<<1)
(0009) #define A11 PORTC|=(1<<6)
(0010) #define A10 PORTC&=~(1<<6)
(0011)
(0012) #define shuju PORTB
(0013) #define reset82550 PORTC&=~(1<<7)
(0014) #define reset82551 PORTC|=(1<<7)
(0015)
(0016) //定义LCD
(0017) #define Disp_On 0x3f
(0018) #define Disp_Off 0x3e
(0019) #define Col_Add 0x40
(0020) #define Page_Add 0xb8
(0021) #define Start_Line 0xc0
(0022) #define RST1 PORTE|=(1<<7)
(0023) #define RST0 PORTE&=~(1<<7)
(0024) #define E1 PORTE|=(1<<6)
(0025) #define E0 PORTE&=~(1<<6)
(0026) #define RW1 PORTE|=(1<<5)
(0027) #define RW0 PORTE&=~(1<<5)
(0028) #define RS1 PORTE|=(1<<3)
(0029) #define RS0 PORTE&=~(1<<3)
(0030) #define LCDCS11 PORTE|=(1<<1)
(0031) #define LCDCS10 PORTE&=~(1<<1)
(0032) #define LCDCS21 PORTE|=(1<<2)
(0033) #define LCDCS20 PORTE&=~(1<<2)
(0034) //定义key
(0035) #define key PIND
(0036) //定义TLC5615
(0037) #define SPI_DATA0 PORTF&=~(1<<0)
(0038)
(0039) #define SPI_DATA1 PORTF|=(1<<0)
(0040) #define SPI_CLK1 PORTD|=(1<<6)
(0041) #define SPI_CLK0 PORTD&=~(1<<6)
(0042) #define CS_DA0 PORTD&=~(1<<7)
(0043) #define CS_DA1 PORTD|=(1<<7)
(0044) unsigned int writeDA;
(0045) //定义TLC2543
(0046) #define tlc2543_clk1 PORTD|=(1<<5)
(0047) #define tlc2543_clk0 PORTD&=~(1<<5)
(0048) #define tlc2543_din1 PORTF|=(1<<1)
(0049) #define tlc2543_din0 PORTF&=~(1<<1)
(0050) #define tlc2543_cs1 PORTF|=(1<<3)
(0051) #define tlc2543_cs0 PORTF&=~(1<<3)
(0052) #define tlc2543_dout (PINF&0X04)
(0053) //定义继电器
(0054) #define sw0 PORTC&=~(1<<5)
(0055) #define sw1 PORTC|=(1<<5)
(0056) //定义ad9851
(0057) #define wclk0 PORTF&=~(1<<5)
(0058) #define wclk1 PORTF|=(1<<5)
(0059) #define fqud0 PORTF&=~(1<<6)
(0060) #define fqud1 PORTF|=(1<<6)
(0061) #define reset98511 PORTF|=(1<<7)
(0062) #define reset98510 PORTF&=~(1<<7)
(0063) #define ad9851shuju PORTA
(0064) //报警
(0065) //#define erjiguanON PORTE&=~(1<<0)
(0066) //#define erjiguanOFF PORTE|=(1<<0)
(0067) #define fengmingqiON PORTD&=~(1<<4)
(0068) #define fengmingqiOFF PORTD|=(1<<4)
(0069)
(0070) signed char jianzhi[5]={0,0,0,0,0};
(0071) unsigned char kongzhi[5];
(0072) signed long int pinlv;
(0073) unsigned int startAD(unsigned char CHN) ;
(0074) void tongdao(unsigned char i);
(0075) unsigned int date1,date;
(0076) float date2;
(0077) unsigned char time=0;
(0078) #pragma interrupt_handler guoliujianche:6
(0079)
(0080) const unsigned char huan[]={0x0A,0x92,0x62,0x9E,0x02,0x18,0x87,0x74,0x84,0x14,0x0C,0x00,0x02,0x01,0x00,0x04,
(0081) 0x05,0x02,0x01,0x00,0x01,0x02,0x04,0x00
(0082) };
(0083)
(0084)
(0085) const unsigned char ying[]={0x08,0xF9,0x02,0x00,0xFE,0x42,0x41,0xFE,0x02,0x82,0xFE,0x00,0x06,0x01,0x02,0x02,
(0086) 0x04,0x04,0x04,0x05,0x04,0x04,0x04,0x00
(0087) };
(0088)
(0089)
(0090) const unsigned char shi[]={0x10,0x08,0xFE,0x01,0x7A,0xCA,0x4A,0xFF,0x4A,0x4A,0x7A,0x00,0x00,0x00,0x07,0x04,
(0091) 0x04,0x02,0x01,0x02,0x04,0x04,0x04,0x00
(0092) };
(0093)
(0094) const unsigned char yong[]={0x00,0xFF,0x49,0x49,0x49,0xFF,0x49,0x49,0x49,0xFF,0x00,0x00,0x06,0x01,0x00,0x00,
(0095) 0x00,0x07,0x00,0x04,0x04,0x07,0x00,0x00
(0096) };
(0097)
(0098) const unsigned char shu[]= {0xA5,0x96,0xCC,0xBF,0x96,0xA5,0x18,0x67,0x84,0x7C,0x04,0x00,0x04,0x05,0x02,0x02,
(0099) 0x03,0x04,0x04,0x02,0x01,0x02,0x04,0x00
(0100) };
(0101)
(0102) const unsigned char kong[]={0x44,0x24,0xFF,0x14,0x26,0x52,0x4A,0xC3,0x4A,0x52,0x26,0x00,0x04,0x04,0x07,0x00,
(0103) 0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x00
(0104) };
(0105)
(0106) const unsigned char yuan[]={0x08,0xD1,0x3A,0x80,0x7F,0x01,0x7D,0x57,0xD5,0x55,0x7D,0x00,0x01,0x07,0x02,0x01,
(0107) 0x04,0x02,0x05,0x04,0x07,0x01,0x06,0x00
(0108) };
(0109)
(0110) const unsigned char wen[]={0x8A,0x6A,0xFE,0x29,0x41,0xAC,0xAB,0xAA,0xAE,0xAA,0xF8,0x00,0x01,0x00,0x07,0x02,
(0111) 0x01,0x07,0x04,0x06,0x04,0x05,0x02,0x00
(0112) };
(0113)
(0114) const unsigned char dya[]= {0x00,0xFF,0x01,0x21,0x21,0xFD,0x21,0x61,0xA1,0x21,0x01,0x00,0x06,0x01,0x04,0x04,
(0115) 0x04,0x07,0x04,0x04,0x04,0x05,0x04,0x00
(0116) };
(0117)
(0118) const unsigned char ddian[]= {0x00,0xFC,0x94,0x94,0x94,0xFF,0x94,0x94,0x94,0xFE,0x04,0x00,0x00,0x01,0x00,0x00,
(0119) 0x00,0x03,0x04,0x04,0x04,0x04,0x06,0x00
(0120) };
(0121)
(0122) const unsigned char chu[]= {0x34,0x2F,0xF4,0xA4,0xE8,0xA4,0xEA,0x09,0xEA,0x04,0xE8,0x00,0x01,0x01,0x07,0x00,
(0123) 0x07,0x02,0x07,0x00,0x01,0x04,0x07,0x00
(0124) };
(0125)
(0126) const unsigned char cu[]={0x00,0xDE,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0xDE,0x00,0x00,0x00,0x07,0x04,0x04,
(0127) 0x04,0x07,0x04,0x04,0x04,0x07,0x00,0x00
(0128) };
(0129)
(0130) const unsigned char heng[]={0x18,0xFF,0x08,0x02,0xFA,0x2A,0x2A,0x2A,0x2A,0xFB,0x02,0x00,0x00,0x07,0x00,0x04,
(0131) 0x05,0x05,0x05,0x05,0x05,0x05,0x04,0x00
(0132) };
(0133)
(0134)
(0135)
(0136) const unsigned char ru []={0x00,0x00,0x00,0xC1,0x31,0x0E,0x30,0xC0,0x00,0x00,0x00,0x00,0x04,0x02,0x01,0x00,
(0137) 0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x00
(0138) };
(0139)
(0140)
(0141)
(0142) const unsigned char you[]={0x42,0x22,0x12,0xFA,0x4E,0x4B,0x4A,0x4A,0xFA,0x02,0x02,0x00,0x00,0x00,0x00,0x07,
(0143) 0x01,0x01,0x01,0x05,0x07,0x00,0x00,0x00
(0144) };
(0145)
(0146)
(0147)
(0148) const unsigned char xiao[]={0x24,0x14,0x4D,0x86,0x6C,0x14,0x08,0x7F,0x84,0x7C,0x04,0x00,0x04,0x02,0x01,0x00,
(0149) 0x03,0x04,0x02,0x01,0x01,0x02,0x04,0x00
(0150) };
(0151)
(0152)
(0153)
(0154) const unsigned char zhixian[]={0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00
(0155) };
(0156)
(0157) const unsigned char dliu[]= {0x11,0xA6,0x70,0x02,0xD2,0x1A,0xD7,0x12,0xDA,0x32,0x02,0x00,0x01,0x07,0x04,0x02,
(0158) 0x01,0x00,0x07,0x00,0x07,0x04,0x07,0x00
(0159) };
(0160)
(0161) const unsigned char guo[]= {0x11,0x16,0xF0,0x04,0x14,0x64,0x04,0x04,0xFF,0x04,0x04,0x00,0x04,0x02,0x01,0x02,
(0162) 0x04,0x04,0x05,0x05,0x05,0x04,0x04,0x00
(0163) };
(0164)
(0165) const unsigned char si[]={0x88,0x86,0xA2,0xCA,0x92,0x83,0xFA,0x82,0x82,0x8A,0x86,0x00,0x00,0x04,0x04,0x04,
(0166) 0x02,0x01,0x00,0x01,0x02,0x04,0x00,0x00
(0167) };
(0168)
(0169)
(0170)
(0171)
(0172) const unsigned char ji[]={0xFF,0x81,0x99,0xE7,0x08,0xC9,0x09,0xF9,0x09,0xC9,0x08,0x00,0x07,0x00,0x00,0x02,
(0173) 0x01,0x04,0x04,0x07,0x00,0x00,0x03,0x00
(0174) };
(0175)
(0176)
(0177)
(0178)
(0179) const unsigned char yu[]={0x11,0x15,0xFD,0x13,0x30,0x01,0xFD,0x07,0xF5,0x05,0xFD,0x00,0x04,0x04,0x07,0x00,
(0180) 0x04,0x04,0x02,0x01,0x01,0x02,0x04,0x00
(0181) };
(0182)
(0183)
(0184)
(0185) const unsigned char zhi[]= {0x10,0x17,0xF5,0x55,0x57,0x5D,0x57,0x55,0xF5,0x17,0x10,0x00,0x04,0x04,0x07,0x05,
(0186) 0x05,0x05,0x05,0x05,0x07,0x04,0x04,0x00
(0187) };
(0188)
(0189)
(0190) const unsigned char bo[]={0x08,0xD1,0x3A,0x00,0xFC,0x24,0xE4,0x3F,0xA4,0x64,0x0C,0x00,0x01,0x07,0x04,0x03,
(0191) 0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x00
(0192) };
(0193)
(0194) const unsigned char xing[]={0x12,0x12,0xFE,0x12,0x12,0xFF,0x92,0x48,0x24,0x13,0x80,0x00,0x04,0x03,0x00,0x00,
(0195) 0x00,0x07,0x04,0x02,0x02,0x01,0x00,0x00
(0196) };
(0197)
(0198)
(0199)
(0200)
(0201) const unsigned char zfv[]= {0x20,0xE0,0x20,0x80,0x60,0x20,0x00,0x00,0x03,0x01,0x00,0x00
(0202) };
(0203)
(0204)
(0205) const unsigned char zfA[]= {0x00,0xE0,0x9C,0xF0,0x80,0x00,0x02,0x03,0x00,0x00,0x03,0x02
(0206) };
(0207)
(0208)
(0209) const unsigned char zfm[]={0xE0,0x20,0xE0,0x20,0xC0,0x00,0x03,0x00,0x03,0x00,0x03,0x00
(0210) };
(0211)
(0212)
(0213) const unsigned char sz0[]={0xF8,0x04,0x04,0x04,0xF8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
(0214) };
(0215)
(0216)
(0217) const unsigned char sz1[]={0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00
(0218) };
(0219)
(0220)
(0221)
(0222) const unsigned char sz2[]={0x18,0x84,0x44,0x24,0x18,0x00,0x03,0x02,0x02,0x02,0x02,0x00
(0223) };
(0224)
(0225) const unsigned char sz3[]={0x08,0x04,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
(0226) };
(0227)
(0228)
(0229) const unsigned char sz4[]={0x40,0xB0,0x88,0xFC,0x80,0x00,0x00,0x00,0x00,0x03,0x02,0x00
(0230) };
(0231)
(0232)
(0233) const unsigned char sz5[]={0x3C,0x24,0x24,0x24,0xC4,0x00,0x01,0x02,0x02,0x02,0x01,0x00
(0234) };
(0235)
(0236)
(0237) const unsigned char sz6[]={0xF8,0x24,0x24,0x2C,0xC0,0x00,0x01,0x02,0x02,0x02,0x01,0x00
(0238) };
(0239)
(0240) const unsigned char sz7[]={0x0C,0x04,0xE4,0x1C,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00
(0241) };
(0242)
(0243)
(0244)
(0245) const unsigned char sz8[]={0xD8,0x24,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
(0246) };
(0247)
(0248)
(0249) const unsigned char sz9[]={0x38,0x44,0x44,0x44,0xF8,0x00,0x00,0x03,0x02,0x02,0x01,0x00
(0250) };
(0251)
(0252)
(0253) const unsigned char xiaoshu[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00
(0254) };
(0255)
(0256) const unsigned char kongke[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
(0257) };
(0258)
(0259) const unsigned char dqing[]= {0x10,0xF1,0x02,0x00,0x2A,0xEA,0xAA,0xBF,0xAA,0xEA,0x2A,0x00,0x00,0x07,0x02,0x01,
(0260) 0x00,0x07,0x02,0x02,0x02,0x07,0x00,0x00
(0261) };
(0262)
(0263) const unsigned char chong[]= {0x04,0x05,0xF5,0x55,0x55,0xFF,0x55,0x55,0xF5,0x05,0x04,0x00,0x04,0x05,0x05,0x05,
(0264) 0x05,0x07,0x05,0x05,0x05,0x05,0x04,0x00
(0265) };
(0266)
(0267) const unsigned char qi[]= {0x00,0x00,0xFE,0xD2,0x52,0x53,0x52,0x52,0x52,0xDE,0x00,0x00,0x04,0x03,0x00,0x07,
(0268) 0x04,0x04,0x04,0x04,0x04,0x07,0x00,0x00
(0269) };
(0270) const unsigned char pin[]={0x90,0x5E,0xF0,0x1F,0xD4,0x11,0xFD,0x05,0xF7,0x05,0xFD,0x00,0x04,0x04,0x02,0x01,
(0271) 0x04,0x04,0x02,0x01,0x00,0x01,0x06,0x00
(0272) };
(0273)
(0274) const unsigned char lv[]={0x42,0x46,0x2A,0x52,0x6A,0xD7,0x6A,0x52,0x2A,0x46,0x02,0x00,0x01,0x01,0x01,0x01,
(0275) 0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x00
(0276) };
(0277) const unsigned char zfM[]={0xFC,0x3C,0xC0,0x3C,0xFC,0x00,0x03,0x00,0x03,0x00,0x03,0x00
(0278) };
(0279) const unsigned char zfk[]={0x04,0xFC,0x80,0xE0,0x20,0x20,0x02,0x03,0x02,0x00,0x03,0x02
(0280) };
(0281)
(0282) const unsigned char *num[]={sz0,sz1,sz2,sz3,sz4,sz5,sz6,sz7,sz8,sz9};
(0283)
(0284)
(0285) //8255
(0286) void delay(unsigned int t)
(0287) {
(0288) unsigned int i,j;
(0289) for(i=0;i<t;i++)
246 2744 CLR R20
247 2755 CLR R21
248 C00B RJMP 0x0254
(0290) for(j=0;j<10;j++)
249 2766 CLR R22
24A 2777 CLR R23
24B C002 RJMP 0x024E
24C 5F6F SUBI R22,0xFF
24D 4F7F SBCI R23,0xFF
24E 306A CPI R22,0xA
24F E0E0 LDI R30,0
250 077E CPC R23,R30
251 F3D0 BCS 0x024C
252 5F4F SUBI R20,0xFF
253 4F5F SBCI R21,0xFF
254 1740 CP R20,R16
255 0751 CPC R21,R17
256 F390 BCS 0x0249
257 940C 21D4 JMP pop_xgsetF000
_writePA:
d --> R10
259 92AA ST R10,-Y
25A 2EA0 MOV R10,R16
(0291) ;
(0292) }
(0293) /*void writePC(unsigned char d,unsigned char x)//PA的第d个端口置X x=0或1
(0294) {
(0295) WROFF; LEOFF;
(0296) shuju=0X09;
(0297) delay(1);
(0298) LEON ;
(0299) delay(1);
(0300) LEOFF;
(0301) delay(1);
(0302) if(x==1)
(0303) shuju=lastPA|(1<<d);
(0304) if(x==0)
(0305) shuju=lastPA&~(1<<d);
(0306) lastPA=shuju;
(0307) WRON ;
(0308) delay(5);WROFF;
(0309)
(0310) }*/
(0311) /*void writePB(unsigned char d)
(0312) {
(0313) WROFF;
(0314) LEOFF;
(0315) shuju=0X05;
(0316) delay(1);
(0317) LEON ;
(0318) delay(1);
(0319) LEOFF;
(0320) delay(1);
(0321) shuju=d;
(0322) WRON ;
(0323) delay(5);WROFF;
(0324)
(0325) }*/
(0326) void writePA(unsigned char d)
(0327) {
(0328)
(0329) WROFF;
25B 9AA8 SBI 0x15,0
(0330) A00;
25C 98A9 CBI 0x15,1
(0331) A10;
25D 98AE CBI 0x15,6
(0332) delay(1);
25E E001 LDI R16,1
25F E010 LDI R17,0
260 DFE3 RCALL _delay
(0333) shuju=d;
261 BAA8 OUT 0x18,R10
(0334) WRON ;
262 98A8 CBI 0x15,0
(0335) delay(5);
263 E005 LDI R16,5
264 E010 LDI R17,0
265 DFDE RCALL _delay
(0336) WROFF;
266 9AA8 SBI 0x15,0
267 90A9 LD R10,Y+
268 9508 RET
_writecommand:
d --> R10
269 92AA ST R10,-Y
26A 2EA0 MOV R10,R16
(0337)
(0338) }
(0339) void writecommand(unsigned char d)
(0340) { WROFF;
26B 9AA8 SBI 0x15,0
(0341) A01;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -