ʽжϴͷʽAT89S51жϹܺI/OӿڵжϹʵI./OݵĴ͡Ƭֻúݴжݴ͵жϷݵĴ͡жϷɺִַСˣжϷʽɴ߹Чʡ
4֡(1) ַʽַʽI/Oַռʹ洢ַռַַֿŵI/Oַռʹ洢ַռȴҪһרŵĶдI/OָͿźš(2) ͳһַʽַʽǰI/O˿ڵļĴݴ洢ԪͬȶԴͳһбַͳһַŵDzҪרŵI/Oֱָʹ÷ݴ洢ָI/OAT89S51ƬʹõI/Oⲿݴ洢RAMͳһַķʽ
5 82C55ͨдּĴĿֵλжϣλΪ1ʱΪʽ֣λΪ0ʱΪCڰλλ/λ֡
6𣺱Ҫ82C55CڵIJ䷽ʽֵλΪ0ʱλװöCøλĿ֪ʽƼĴĵַΪ7FFFH
ORG 0100H
ּĴַ7FFFHDPTR PC70
MAIN: MOV DPTR,#7FFFH
MOV A,#0EH MOVX @DPTR,A MOV A,#09H MOVX @DPTR,A END
PC41
7𣺵һݲ͵PA7PA0ʱ豸Զѡͨ
A
82C55һ͵ƽѡͨźţPA7-PA0ݴPAڵݻ/Ȼʹ뻺IBFAɸߵƽ֪ͨ豸82C55PAյݡ82C55
A
ɵ͵ƽ˸ߵƽIBFA
Ϊ1״̬жINTEAΪ1ʱʹINTRɸߵƽAT89S51APC3жINTEA״̬ûͨPC4λ/λơAT89S51ӦжϺͨжϷPAڵݻ/ȡ跢ݡݱCPUߺ82C55INTRAϵжʹIBFAΪ͵ƽ֪ͨһݡ
881C55Ķ˿¼֣/״̬ĴPAڡPBڡPCڡĸ8λĴ8λĴԼRAMԪIO/
A2A1A0˿
ַTIMERINǼţڶ81C55Ƭڵ14λ1TIMEROUTΪš14λΪ0ʱͿڸźŵIJѡļʽйء
9𣺵·ͼԲοͼ9-10PAÿһλӶܵܵĸӵءPBÿ1λһغ裬һֱӽӵءֻҪPBڵֵPAھͿĿҪˡ
ORG 0100H
MOV A#10000010B
PAڷʽ0PBڷʽ0
MIAN
MOV DPTR#0FF7FH ƿڵַDPTR MOVX DPTRA
ͷʽ
MOV DPTR#0FF7DH PBڵַDPTR MOVX ADPTR
뿪Ϣ
MOV DPTR#0FF7CH PAڵַDPTR MOVX DPTRA END
PAڵPBڵӦĶ
1081C55ijֵΧǣ3FFFH-2HƵΪ4MHzֵΪ3FFFHʱʱʱΪ0.004096S
11𣺽1MHzıΪ10msķʵϾǷƵƵǰƵ֮Ϊ100:1ֻҪʱֵΪ64HͿˡI/OڵַΪ
7F00H-7F05H
START MOV
DPTR#7F04H ָָ8λ A#64H DPTRA
DPTR
ͳֵA
ֵ8λ ָ8λ
MOV MOVX INC
MOV MOVX MOV MOV MOVX END
A#40H DPTEA
DPTR#7F00H ָ/״̬ A#0C2H DPTEA
趨
10 AT89S51̡ʾ̡ӡĽӿ
ο
1. A MAX7219רʾоƬڼ̣BCH451оƬҲڿƼ̣Cԣ BUSYźſΪѯźŻжźʹãʱźACKãELEDܵǿԱģ10-1еġaζӦֽڵλdpζӦֽڵλıˡ
2. ڰıպϺͶϿУڿصĻеԣ˰IJĻе״̬ȡпִܳһDzӲȥȥԭڵһμмʱüӦΪ͵ƽִһʱ10msӳȷϸߵƽǷȻΪ͵ƽΪ͵ƽȷΪȷʵм¡
3. 𣺾̬ʾʱǷֿ͵ÿһλLEDϵġ̬ʾͬʱ
ÿһLEDϣٸλѡȷһλLEDʾ̬ʾȺܸߣռý϶ࡣ̬ʾռý٣ʺʾλ϶ijϡ
4. 80H7FH
5. 𣺰С߽ϣС߷ֱӵصˡͨӵ+5Vϣްʱߴڸߵƽ״̬аʱߵƽ״̬ߵĵƽߵĵƽΪͣߵƽΪͣߵĵƽΪߣߵĵƽΪߡСźʵĴȷպϼλá
6. ȶP1ڸλ͵͵ƽȡP1ڵλֵٶP1ڵλ͵͵ƽȡP1ڸλֵζֵһ͵õ˰룬ڸҼֵ
KEYIN: MOV
MOV ANL
P1,#0FH A,P1 A,#0FH B,A P1,#0F0H A,P1 A,#0F0H A,B
ת
MOV MOV MOV ANL ORL
CJNE A,#0FFH,KEYIN1 RET
δ ݴ
ָ
KEYIN1: MOV B,A
MOV
DPTR,#KEYCOD