B: Introduction to CKIT- 06A
The CKIT (Fig-3a and 3b) is a very low cost MCU learning/development system and is particularly built for the students and the amateurs, who cannot easily afford to procure the costly development systems like MicroTalk-8051 (Fig-4) and a conventional ROM programmer.
Thanks to the Atmel Co. for the development and release of their ‘S-Series’ of CISC (89S51, 89S52, 89S8252) and RISC (S2313, S8515) microcontrollers, which inspired the author to develop the CKIT. These MCU have hardware ports called ‘In System Programming Port’ or simply ISP Port. The ISP port allows a user to write binary codes into the EEPROM of the MCU using only a 3-core cable and a programming driver.
Figure-2 refers to the hardware aspect of the ISP port of the MCU. The DOS-based Software Driver (P89S51.EXE), DOS-based 8051 Assembler (ASM51), InteHex-to-BINary Converter, Example Programs, Data Conversion Algorithms and Example System Designs (Digital Taximeter, Digital Weighing Machine and Remote Controlled Regulation System) could be found in the User Technical Reference Manual that accompanies the CKIT trainer. The source codes for the software driver could be obtained from the author under some moderate conditions.
C: Example System Design using CKIT06A and 89S51 MCU
Procedures:
1. Use telephone hook up wires and build the following circuit on the breadboard and connect them with the MCU as per diagram of Fig-5.
i. 20mS TT (Time Tick) acquisition circuit from the line frequency
ii. Time Display Unit using CC-type 7-Sement Display devices
2. Boot the PC in pure DOS mode and enter in the path: C:\CKITA
3. Connect the CKIT with the PC using the LPT port.
4. Store the program C:\CKITA\CK24HR.BIN in the code memory of the MCU.
5. Execute the program: CK24HR.
6. The 24-Hr Clock should run. If the clock does not work, adjust the time delay of the program.
Design Analysis of the 24-Hr Clock System:
1. See Figure-6 for the Data Structure of 24-Hr Clock
2. The Source Codes for the 24-Hr Clock:
$mod51
; program for 7segment test
$OBJECT(c:\ckita\CK24Hr.obj)
ORG 0000H
DB 02H
DB 00H
DB 10H
ORG 0010H
L1: MOV SP, #70H
MOV PSW, #00H
MOV PSW, #00H
MOV 54H, #00H ; Hour
MOV 53H, #00H ; Minutes
MOV 52H, #00H ; Seconds
MOV 53H, #00H ; Minutes
MOV 52H, #00H ; Seconds
MOV 40H, #3FH ; 0
MOV 41H, #06H ; 1
MOV 42H, #5BH ; 2
MOV 43H, #4FH ; 3
MOV 44H, #66H ; 4
MOV 45H, #6DH ; 5
MOV 46H, #7DH ; 6
MOV 47H, #07H ; 7
MOV 48H, #7FH ; 8
MOV 49H, #6FH ; 9 CC-code table at upper RAM of MCU
MOV 41H, #06H ; 1
MOV 42H, #5BH ; 2
MOV 43H, #4FH ; 3
MOV 44H, #66H ; 4
MOV 45H, #6DH ; 5
MOV 46H, #7DH ; 6
MOV 47H, #07H ; 7
MOV 48H, #7FH ; 8
MOV 49H, #6FH ; 9 CC-code table at upper RAM of MCU
MOV IE, #00H ; all interrupts are disabled
MOV TMOD, #06H; ; Time Integration Tick (for 1sec)
MOV TH0, #0CEH;
MOV TL0, #0CEH
CLR TF0
SETB TR0 ; Timer-0 is put into run mode
MOV TMOD, #06H; ; Time Integration Tick (for 1sec)
MOV TH0, #0CEH;
MOV TL0, #0CEH
CLR TF0
SETB TR0 ; Timer-0 is put into run mode
HERE:
JBC TF0, TIME_UPDATE
LJMP CCX7S ; 1-sec has not yet elapsed
LJMP CCX7S ; 1-sec has not yet elapsed
TIME_UPDATE:
MOV A, 52H
ADD A, #01H
DA A
CJNE A, #60H, ADJ1
MOV 52H, #00H
MOV A, 53H
ADD A, #01H
DA A
CJNE A, #60H, ADJ2
MOV 53H, #00H
MOV A, 54H
ADD A, #01H
DA A
CJNE A, #24H, ADJ3
MOV 54H, #00H
LJMP BCD2CC
ADD A, #01H
DA A
CJNE A, #60H, ADJ1
MOV 52H, #00H
MOV A, 53H
ADD A, #01H
DA A
CJNE A, #60H, ADJ2
MOV 53H, #00H
MOV A, 54H
ADD A, #01H
DA A
CJNE A, #24H, ADJ3
MOV 54H, #00H
LJMP BCD2CC
ADJ1:
MOV 52H, A
LJMP BCD2CC
LJMP BCD2CC
ADJ2:
MOV 53H, A
LJMP BCD2CC
LJMP BCD2CC
ADJ3:
MOV 54H, A
BCD2CC:
MOV R0, #54H ; R0 points at BCD Table
MOV R1, #3FH ; R1 points at CA Table
MOV R2, #03H ; Number of BCD bytes to convert
MOV R1, #3FH ; R1 points at CA Table
MOV R2, #03H ; Number of BCD bytes to convert
LSR1:
MOV A, @R0 ; A=00 ; getting 1st BCD
RR A
RR A
RR A
RR A
ANL A, #0FH ; A =00 ; to get cc code
ADD A, #40H ; A= 80
MOV 03H, R1 ; R1=R3=3F ; temporary saved
MOV R1, A ; R1 = 40
MOV A, @R1 ; A = C0
MOV R1, 03H ; R1 = R3 = 3F
MOV @R1, A ; (3F) = C0H
MOV A, @R0 ; A = 00
ANL A, #0FH
ADD A, #40H ; A = 40
MOV 03H, R1 ; R1=R3=3F
MOV R1, A ; R1 = 40
MOV A, @R1 ; A = C0
MOV R1, 03H ; R1=R3 = 3F
DEC R1 ; R1=3E
MOV @R1, A ; (3EH) = C0
DJNZ R2, LFW
LJMP FRWX
RR A
RR A
RR A
RR A
ANL A, #0FH ; A =00 ; to get cc code
ADD A, #40H ; A= 80
MOV 03H, R1 ; R1=R3=3F ; temporary saved
MOV R1, A ; R1 = 40
MOV A, @R1 ; A = C0
MOV R1, 03H ; R1 = R3 = 3F
MOV @R1, A ; (3F) = C0H
MOV A, @R0 ; A = 00
ANL A, #0FH
ADD A, #40H ; A = 40
MOV 03H, R1 ; R1=R3=3F
MOV R1, A ; R1 = 40
MOV A, @R1 ; A = C0
MOV R1, 03H ; R1=R3 = 3F
DEC R1 ; R1=3E
MOV @R1, A ; (3EH) = C0
DJNZ R2, LFW
LJMP FRWX
LFW:
DEC R0
DEC R1
LJMP LSR1
DEC R1
LJMP LSR1
FRWX:
MOV A, 3EH ; placing points
ORL A, #80H
MOV 3EH, A
MOV A, 3CH
ORL A, #80H
MOV 3CH, A
ORL A, #80H
MOV 3EH, A
MOV A, 3CH
ORL A, #80H
MOV 3CH, A
CCX7S:
MOV P0, 3FHMOV P2, #3EH ; DP0 0011 1110LCALL TDELAY
MOV P0, 3EH
MOV P2, #3DH ; DP1 0011 1101
LCALL TDELAY
MOV P0, 3DH
MOV P2, #3BH ; DP2 0011 1011
LCALL TDELAY
MOV P0, 3CH
MOV P2, #37H ; DP3 0011 0111LCALL TDELAY
MOV P0, 3BHMOV P2, #2FH ; DP4 0010 1111LCALL TDELAY
MOV P0, 3AH
MOV P2, #1FH ; DP5 0001 1111LCALL TDELAY
LJMP HERE
MOV P0, 3EH
MOV P2, #3DH ; DP1 0011 1101
LCALL TDELAY
MOV P0, 3DH
MOV P2, #3BH ; DP2 0011 1011
LCALL TDELAY
MOV P0, 3CH
MOV P2, #37H ; DP3 0011 0111LCALL TDELAY
MOV P0, 3BHMOV P2, #2FH ; DP4 0010 1111LCALL TDELAY
MOV P0, 3AH
MOV P2, #1FH ; DP5 0001 1111LCALL TDELAY
LJMP HERE
TDELAY:
MOV R6, #20H
HERE2:
MOV R7, #20H
HERE1:
DJNZ R7, HERE1
DJNZ R6, HERE2
RET
DJNZ R6, HERE2
RET
END
Tidak ada komentar:
Posting Komentar