009
09.01.2015, 16:41 Uhr
Deff
|
Ist der AT89C2051 Deiner Meinung nach ein ATMEGA? Für mich nämlich nicht. Wenn Du Dir Mühe gibst, wirst Du die Firmware im Netz sicherlich auch finden. Zum Atmel-Chips programmieren gibt es bei Pollin ein EVA-Board zum Selbstlöten. Das, was Du als 3,6V-Pufferbatterie bezeichnest, ist übrigens eine 3V-Lithiumzelle CR2032! Ich habe Dir mal die Mühe abgenommen und den Quellcode gefunden => http://www.h-renrew.de/h/avrclock/clockc.tar.gz Kannst ja mal vergleichen, ob der identisch mit dem ist!
Quellcode: | ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; AT89C2051 clock procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The timer T0, T1 overflows cycle as 50MS, T0 is counted and used second, T1 uses in order to glimmer at the time of adjustment, ; P3.7, in order to adjust the button, P1 mouth exports the mouth for the character, adopting the male genital altogether reveals that manages. ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Cut off the entry program; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ORG 0000H ; The procedure carries out and begins the address LJMP START ; Jump to the grade START and carry out ORG 0003H ; Cut off 0 and cut off the entry to the procedure outside RETI ; Cut off 0 and stop returning outside ORG 000BH ; The timer T0 cuts off the entry to the procedure LJMP INTT0 ; Jump to INTTO and carry out ORG 0013H ; Cut off 1 and cut off the entry to the procedure outside RETI ; Cut off 1 and stop returning outside ORG 001BH ; The timer T1 cuts off the entry to the procedure LJMP INTT1 ; Jump to INTT1 and carry out ORG 0023H ; Cut off the procedure entry address serially RETI ; Cut off the procedure and return serially ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Main procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; START: MOV R0,#70H ; Clear 70H-7AH amounts to 11 memory units MOV R7,#0BH ; CLEARDISP: MOV @R0,#00H ; INC R0 ; DJNZ R7,CLEARDISP ; MOV 20H,#00H ; Clear 20H mark and use MOV 7AH,#0AH ; Put ” Go out the incantation ” Data MOV TMOD,#11H ; Set T0, T1 as 16 timers MOV TL0,#0B0H ; 50MS regular initial value T0 times to use MOV TH0,#3CH ; 50MS regular initial value MOV TL1,#0B0H ; 50MS regular initial value T1 glimmers and uses regularly MOV TH1,#3CH ; 50MS regular initial value SETB EA ; Always cut off open SETB ET0 ; Allow T0 to cut off SETB TR0 ; Open T0 timer MOV R4,#14H ; Spend initial value regularly in one second ‘ 50MS* 20 START1: LCALL DISPLAY ; Transfer and reveal the subprogram JNB P3.7,SETMM1 ; P3.7 mouth transfers to time and adjusts the procedure for 0 o’clock SJMP START1 ; P3.7 mouth to jump, answer START1 1 o’clock SETMM1: LJMP SETMM ; Turn into time and adjust the procedure SETMM ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Timing procedure of one second; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; T0 cuts off the service routine INTT0: PUSH ACC ; It is protected that the accumulating device is stacked PUSH PSW ; It is protected that the state word is stacked CLR ET0 ; Close T0 and stop allowing CLR TR0 ; Close the timer T0 MOV A,#0B7H ; Cut off the response time to revise synchronously ADD A,TL0 ; Low 8 initial value are revised MOV TL0,A ; Reset initial value ‘ Low 8 amendment MOV A,#3CH ; Revise 8 initial value high ADDC A,TH0 ; MOV TH0,A ; Reset initial value ‘ It is 8 amendment high SETB TR0 ; Open the timer T0 DJNZ R4, OUTT0 ; Have stopped not getting to stop withdrawing 20 times ADDSS: MOV R4,#14H ; 20 times break down, reach ‘ One second Compose initial value again MOV R0,#71H ; Point to second the intersection of timing and Entrance ‘ 71H-72H ACALL ADD1 ; Transfer and add a procedure ‘ Add by one second and operate MOV A,R3 ; The data are put into A R3 shut for 2 the decimal system arrays second CLR C ; Clear carry flag CJNE A,#60H,ADDMM ; ADDMM: JC OUTT0 ; Stop withdrawing at 60 seconds small ACALL CLR0 ; It is big and clear 0 to the timing unit of second while or equals 60 secondsing MOV R0,#77H ; Point to, divide the intersection of timing and Entrance into ‘ 76H-77H ACALL ADD1 ; Divide the timing unit to add by one minute MOV A,R3 ; Divide the data to put into A CLR C ; Clear carry flag CJNE A,#60H,ADDHH ; ADDHH: JC OUTT0 ; Smaller than 60 timesharing and stop withdrawing ACALL CLR0 ; Great clear 0 units when it is counted or is equal to the time of 60 MOV R0,#79H ; Point to hour the intersection of timing and Entrance ‘ 78H-79H ACALL ADD1 ; The timing unit is added by an hour hour MOV A,R3 ; The data are put into A hour CLR C ; Clear carry flag CJNE A,#24H,HOUR ; HOUR: JC OUTT0 ; Smaller than 24 hours to stop withdrawing ACALL CLR0 ; Great clear 0 units when it is counted or is equal to hour of 24 hours OUTT0: MOV 72H,76H ; It divide when it stop not withdrawing, when move timing unit data MOV 73H,77H ; Enter and reveal the unit correspondingly MOV 74H,78H ; MOV 75H,79H ; POP PSW ; Resume word ‘ Go out of the inn POP ACC ; Resume the accumulating device SETB ET0 ; Open T0 cuts off RETI ; Stop returning ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Flicker the procedure while adjusting; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; T1 cuts off the service routine, is used as time and adjusted the unit and glimmered on the instruction while adjusting INTT1: PUSH ACC ; Cut off scene protection PUSH PSW ; MOV TL1, #0B0H ; Install the timer T1 regular initial value MOV TH1, #3CH ; DJNZ R2,INTT1OUT ; Have not got for 0.3 seconds and withdrawn from cutting off 50MS cuts off for 6 times MOV R2,#06H ; Reset for 0.3 seconds and use initial value regularly CPL 02H ; It marks fetching in glimmering inside out to get regularly in 0.3 seconds JB 02H,FLASH1 ; 02H location reveals the unit at 1 o’clock ” Go out ” MOV 72H,76H ; 02H location reveals normally for 0 o’clock MOV 73H,77H ; MOV 74H,78H ; MOV 75H,79H ; INTT1OUT: POP PSW ; Resume the scene POP ACC ; RETI ; Stop withdrawing FLASH1: JB 01H,FLASH2 ; 01H 1 o’clock in location, rotate, put out, control hour MOV 72H,7AH ; 01H location is 0 o’clock, ” Go out the incantation ” The data are put and divided MOV 73H,7AH ; Reveal Entrance ‘ 72H-73H ,Will not reveal that divide the data MOV 74H,78H ; MOV 75H,79H ; AJMP INTT1OUT ; Rotate and stop withdrawing FLASH2: MOV 72H,76H ; 01H location is 1 o’clock, ” Go out the incantation ” The data are put for hour MOV 73H,77H ; Reveal Entrance ‘ 74H-75H ,The data will not reveal hour MOV 74H,7AH ; MOV 75H,7AH ; AJMP INTT1OUT ; Rotate and stop withdrawing ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Add a sub procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ADD1: MOV A,@R0 ; Fetch the present timing unit data to A DEC R0 ; Point to the first address SWAP A ; The data are exchanged with low four four high in A ORL A,@R0 ; The data put low four into A in the first address ADD A,#01H ; A adds by 1 and operates DA A ; The decimal system is adjusted MOV R3,A ; Move in R3 register ANL A,#0FH ; Change 0 four high MOV @R0,A ; Put back the first address unit MOV A,R3 ; Fetch and store the data in R3 temporarily INC R0 ; Point to the present address unit SWAP A ; The data are exchanged with low four four high in A ANL A,#0FH ; Change 0 four high MOV @R0,A ; The data are put into looking on as paring in the address unit RET ; The subprogram returns ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Zero clearing procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Reply the small incidental to the timing unit CLR0: CLR A ; Clear accumulating device MOV @R0,A ; Clear present address unit DEC R0 ; Point to the first address MOV @R0,A ; The first address unit is clear 0 RET ; The subprogram returns ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; The clock adjusts the procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Enter this procedure when the button is pushed while adjusting SETMM: cLR ET0 ; Close the timer T0 to cut off CLR TR0 ; Close the timer T0 LCALL DL1S ; Procedure of transferring time delay for one second JB P3.7,CLOSEDIS ; The key pushes time and is less than one second, close to reveal the province MOV R2,#06H ; Enter the state while adjusting, compose and glimmer regular initial value SETB ET1 ; Allow T1 to cut off SETB TR1 ; Open the timer T1 SET2: JNB P3.7,SET1 ; P3.7 mouth, for 0 key has not been released ,Wait SETB 00H ; Key release, it indicates that 1 is put to divide and adjust glimmering SET4: JB P3.7,SET3 ; Wait for the key to push LCALL DL05S ; There are keys that are pushed, delay time for 0.5 seconds JNB P3.7,SETHH ; It is greater than the hour state of the modulation of 0.5 seconds to push time MOV R0,#77H ; It is less than 0.5 seconds to add by one minute and operate to push time LCALL ADD1 ; Transfer it with a subprogram MOV A,R3 ; Fetch and adjust the unit data CLR C ; Clear carry flag CJNE A,#60H,HHH ; Adjust the unit data and compare with 60 HHH: JC SET4 ; It is smaller than 60 to transfer to SET4 and circulate to adjust the unit data LCALL CLR0 ; It is great and clear 0 to adjust the unit data while or equals 60ing CLR C ; Clear carry flag AJMP SET4 ; Jump and turn into SET4 to circulate CLOSEDIS: SETB ET0 ; Electricity of province LED does not reveal State. Open T0 to cut off SETB TR0 ; Turn on T0 timer ‘ Open the clock CLOSE: JB P3.7,CLOSE ; There is no button to push, wait. LCALL DISPLAY ; There are keys that are pushed, adjust revealing the subprogram delays time and pares trembling JB P3.7,CLOSE ; It is the interference to return CLOSE waits WAITH: JNB P3.7,WAITH ; Wait for key release LJMP START1 ; Main program of returning LED data reveal only SETHH: CLR 00H ; Divide, glimmer, indicate, drive out ‘ State that entry is adjusted hour SETHH1: JNB P3.7,SET5 ; Wait for key release SETB 01H ; It indicates that 1 is put to change hour SET6: JB P3.7,SET7 ; Wait for the button to push LCALL DL05S ; There is the key that pushes and delays time for 0.5 seconds JNB P3.7,SETOUT ; Push time for greater than 0.5 seconds and withdraw from time to adjust MOV R0,#79H ; It is less than 0.5 seconds to add by an hour and operate to push time LCALL ADD1 ; Adjust it with a subprogram MOV A,R3 ; CLR C ; CJNE A,#24H,HOUU ; The unit data of the timing compare with 24 HOUU: JC SET6 ; Smaller than 24 to transfer to SET6 and circulate LCALL CLR0 ; It is big while or equals 24ing clear 0 is operated AJMP SET6 ; Jump and turn into SET6 to circulate SETOUT: JNB P3.7,SETOUT1 ; Withdraw from the procedure while adjusting. Wait for key release LCALL DISPLAY ; Delay time and pare trembling JNB P3.7,SETOUT ; Shake, return SETOUT wait again CLR 01H ; Clear to adjust the hour marker CLR 00H ; Sign of clear change of the mark awarded CLR 02H ; Sign that clear to glimmer CLR TR1 ; Close the timer T1 CLR ET1 ; Close the timer T1 to cut off SETB TR0 ; Open the timer T0 SETB ET0 ; Turn on timer T0, break down ‘ Time to begin LJMP START1 ; Jump back to the main program SET1: LCALL DISPLAY ; Key release while waiting for transferring and revealing the procedure ‘ Change of the mark awarded AJMP SET2 ; There is no clock to reveal while pushing to prevent the key SET3: LCALL DISPLAY ; The clock shows using while waiting for the button of change of the mark awarded AJMP SET4 SET5: LCALL DISPLAY ; Key release while waiting for transferring and revealing the procedure ‘ Adjust for hour AJMP SETHH1 ; There is no clock to reveal while pushing to prevent the key SET7: LCALL DISPLAY ; The clock shows using to wait when adjusting hour buttons AJMP SET6 SETOUT1: LCALL DISPLAY ; The key is released and waited to withdraw from the clock when adjusting AJMP SETOUT ; There is no clock to reveal while pushing to prevent the key ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Reveal the procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Reveal the data, in unit 70H-75H, male genital’s digital tube reveal altogether by six LEDs, P1 mouth outputs a section of code data, P3 mouth done ; Scan and control, each LED number is in charge of 1MS time of flashing and circulate by turn. DISPLAY: MOV R1,#70H ; Point to and reveal the first location of data MOV R5,#0FEH ; Scan and control the initial value of words PLAY: MOV A,R5 ; Scan words to put into A MOV P3,A ; Export from P3 mouth MOV A,@R1 ; Fetch and reveal the data to A MOV DPTR,#TAB ; Choose the table address of one section of codes MOVC A,@ADPTR ; Check that reveals the data correspond to one section of codes MOV P1,A ; A code is put into P1 mouth LCALL DL1MS ; Reveal 1MS INC R1 ; Point to the next address MOV A,R5 ; Scanning controls words to put into A JNB ACC.5,ENDOUT ; ACC.5 =Reveal bunch once at 0 RL A ; The data are circulated and moved to left in A MOV R5,A ; Put back to R5 AJMP PLAY ; Jump back to PLAY and circulate ENDOUT: SETB P3.5 ; Reveal that is over once, P3 mouth reset MOV P1,#0FFH ; P1 mouth reset RET ; The subprogram returns TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFH ; One section of code tables of male genital altogether ” 0″ ” 1″ ” 2″ ” 3″ ” 4″ ” 5″ ” 6″ ” 7″ ” 8″ ” 9″ ” Non- bright ” ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Time delay procedure; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; 1MS time delay procedure, LED reveals the procedure uses DL1MS: MOV R6,#14H DL1: MOV R7,#19H DL2: DJNZ R7,DL2 DJNZ R6,DL1 RET ; 20MS time delay procedure, adopts and transfers and reveals the phenomenon that the display of the subprogram in order to improve LED glimmers DS20MS: ACALL DISPLAY ACALL DISPLAY ACALL DISPLAY RET ; Time delay procedure, are used as the size of time of the button judging DL1S: LCALL DL05S LCALL DL05S RET DL05S: MOV R3,#20H ; 8 point *32 milliseconds =0.196 seconds DL05S1: LCALL DISPLAY DJNZ R3,DL05S1 RET ; END ; The procedure is over |
-- Die Politik ist ein Versuch der Politiker, zusammen mit dem Volk mit den Problemen fertig zu werden, die das Volk ohne die Politiker niemals gehabt hätte. (Dieter Hildebrandt) Dieser Beitrag wurde am 09.01.2015 um 16:59 Uhr von Deff editiert. |