This is my project subject microcontroller and i want to share for who want to try it or make assignment about this. I have tuning this program assembly when click pattern it will increment and when click stop button it reset to 00.
Firstly , I made a schematic circuit in Proteus and write program in Keil Uvision3 and perform simulation.You can see circuit that i have make.If your simulation going ok you can make circuiT.
IMPORTANT: ANY CONNECTION SHOULD FOLLOW THE SCHEMATIC DIAGRAM TO AVOID THE COMPONENTS FROM DAMAGE.
Circuit
Assembly Program
Org 00Hdata_one equ P3data_ten equ P2IPIN EQU P1.0DPIN EQU P1.1Mynumber Equ 30Hmain_prog:CALL INITAGAIN:AG2: JB IPIN,AG1CALL DELAY1 ;debounceJB IPIN,AG1JNB IPIN,$ ;wait till switch releaseINC MYNUMBERmov a,mynumbercjne a,#100,pq1mov mynumber,#0pq1:call bcd ;diaplay dataAG1: JB DPIN,AG2CALL DELAY1JB DPIN,AG2JNB DPIN,$clr mynumbermov a,#0C0Hcjne a,#0C0H,pq2mov mynumber,#00pq2:call bcdJMP AGAININIT:MOV data_ten,#0C0HMOV data_one,#0c0Hmov Mynumber,#0mov p1,#255 ;set port 1 as input BY . IT SHOULD BE 1RETDELAY1: MOV R4,#255DJNZ R4,$RETBCD: Mov A,MynumberMov B,#10Div ABmov dptr,#seg_convMOVC A,@A+DPTR ; MOVE DATA @A+DPTR IN Amov data_ten, Amov A,Bmov dptr,#seg_convMOVC A,@A+DPTR ; MOVE DATA @A+DPTR IN Amov data_one, ARetdelay: MOV R5,#0ffhMOV R6,#0ffHMOV R7,#2delay_loop: DJNZ R5,delay_loopDJNZ R6,delay_loopDJNZ R7,delay_loopRETSeg_conv:DB 0C0H ; 0DB 0F9H ; 1DB 0A4H ; 2DB 0B0H ; 3DB 099H ; 4DB 092H ; 5DB 082H ; 6DB 0F8H ; 7DB 080H ; 8DB 090H ; 9END
0 Ulasan