Very practical really! Serial LED shows circuit is designed
- Time:
- Click:95
- source:KAPLOWITZ CNC Machining
This program uses means of indication process work monitor of time means control works. 12 monitor use dynamic scanning to show, every monitor indication time is about 1.
67ms, by timer T0 control. T0 time time shows to generation interrupt, enter show interrupt a program to show below one digit is occupied. This kind of indication means can improve the work efficiency of CPU, but the refresh speed of accurate control monitor. 4.
Interrupt indication subprogram to use a staff one program, ordinal on canal of 12 digit code show 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1ORG 0000HDSDATE BIT P1.
0; serial data inputs DSCLK BIT P1.
1; DSLUCK BIT P1 of serial shift clock.
2; Collateral lock puts clock DISBUF EQU 51H; Indication buffer head location DS20 EQU 34H; 20ms time register (12 indication tally) LJMP MAIN; turns main program ORG 000BHLJMP TIMINT; Turn time show interrupt subprogram MAIN: MOV SP, #70H; MOV 51H of buy vertebra stack pointer, #00H; Beforehand buy shows buffer MOV 52H, #01HMOV 53H, #02HMOV 54H, #03HMOV 55H, #04HMOV 56H, #05HMOV 57H, #06HMOV 58H, #07HMOV 59H, #08HMOV 5AH, #09HMOV 5BH, #00HMOV 5CH, #01HMOV 08H, #DISBUF; 1 area R0 points to indication buffer head location MOV 0EH, #07H; Buy is initiative accuse a code (1 area R6) MOV 0FH, #0FFH; Buy is initiative accuse a code (1 area R7) MOV TMOD, #01H; Buy T0 is 1.
67ms timer MOV TL0, #00HMOV TH0, #0FAHMOV DS20, #12; Buy shows digit tally SETB TR0; The T0SETB EA that start; Interrupt SETB ET0; Open T0 to interrupt HERE: SJMP HERETIMINT: PUSH PSW; Time show interrupt a subprogram, condition word enters inn MOV PSW, #08H; Replacement condition word, choose PUSH ACC of register of 1 division job; Accumulator enters inn PUSH B; B register takes pen CLR TR0; Stop T0 time MOV TH0, #0FAH; Replacement 1.
MOV TL0 of 67ms time initial value, #00HSETB TR0; Time MOV R5 of the T0 that start, 0FH; Accuse a code to send R4, R5MOV R4, 0EHLCALL DIS1; Call show one digit piles up pipe program SETB C; Form show below one an apposition accusing a code at the MOV A in 1 area R6, R7, r6SETB ACC.
4RRC AMOV R6, AMOV A, r7RRC AMOV R7, ADJNZ DS20, LOOP1; 12 showed deny, not was over exit, if show replacement MOV DS20, #12; Replacement shows tally MOV R0, #DISBUF; Replacement shows buffer finger MOV R7, #0FFH; Replacement is initiative a MOV R6 accusing a code, #07HLOOP1: POP B; Restore spot POP ACCPOP PSWRETI; Interrupt return DIS1: MOV DPTR, #TAB; Show one digit piles up pipe program, point to paragraph of stopwatch MOV A, @R0; Take wait for INC R0 of indication character data; MOVC A of modification buffer finger, @A+DPTR; Check a watch to take indication character paragraph code MOV R3, a; Will paragraph code and combination accusing a code becomes MOV R1 of 20 effective and serial codes, #0CH; The MOV A in R3 of park of 20 effective and serial codes, R4, R5, @R1SWAP AMOV @R1, AMOV A, r3XCHD A, @R1MOV A, @R1SWAP AMOV @R1, AMOV A, r3SWAP AMOV R3, AMOV R1, #20; Buy is serial output tally DIS0: MOV A, r3; Serial shift of R3, R4, R5, output by R5 perch. RRC AMOV R3, AMOV A, r4RRC AMOV R4, AMOV A, r5RRC AMOV R5, AMOV DSDATE, c; The most exalted send to 595 chip serial input carries SETB DSCLK; Produce 595 chip NOPCLR DSCLK of serial input signal; Serial input lock puts DJNZ R1, DIS0; 20 2 output that enter a code are over deny, not was over continue SETB DSLUCK; Produce 595 chip collateral output signal, character begins to show NOPCLR DSLUCK; Output character data puts RETTAB by 595 chip lock: DB 3FH, 06H, 5BH; Show paragraph of stopwatch DB 4FH, 66H, 6DHDB 7DH, 07H, 7FHDB 6FH, 00H, 40HEND CNC Milling CNC Machining