19
EKT 222 MICROPRESSOR SYSTEM LAB 5 INTERFACING WITH OTHER I/O DEVICES Revision 2019

EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT 222

MICROPRESSOR SYSTEM

LAB 5

INTERFACING WITH

OTHER I/O DEVICES

Revision 2019

Page 2: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

1 UniMAP

LAB 5: Interfacing with Other IO devices

Objectives:

1) Ability to create advance program instructions for I/O interfaces. 2) Ability to use branching instructions 3) Ability to execute and demonstrate the program instructions 4) Ability to analyze the 8085 register and memory map conditions

Equipments : 1. Computer station with Windows OS, Tera Term Serial Terminal and MY1 8085

simulation program 2. Microprocessor Training Kit Board –MTK-85 3. 8085 Instruction Sets (Assembly Code) 4. 8085 Instruction Sets (Machine Code)

Introduction The Microprocessor Training Kit MTK-85 has onboard I/O devices such as 4

LEDs, an 20x4 text LCD display, 4 seven segment LEDs, 28-keys keypad, interrupt switch, buzzer counters and user Programmable Port Interface (PPI). User can access LCD display, seven segment LED and keypad through predefined function in the monitor program. These devices also can be accessed through user-defined function.

Table 1 below lists out the available devices and its operating procedures:

No I/O Devices Description

1 4 output pins and connected to 4 LEDs

Provide 4 lines of output and LED indicator to

indicate the status of lower nibbles (D0-D3) of GPIO port

2 4 input pin - GPIO Provides input lines status of higher nibbles (D4-D7) of GPIO port

3 LCD Text Display (output)

20 x 4 characters LCD display.

Page 3: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

2 UniMAP

4

7-segment LED (output)

Common Cathode 6 digit 7-segment LED . Requires 8-bit data to send and operate the desired segment. These 7-segment displays are driven by port B [7:0] (segment data lines) & Port C[3:0] (digit control) of System PPI. Port C[3:0] output is also used by keypad device.

5

28 keys Keypad (input)

28 keys keypad driven by system PPI of Port C[3:0] – column control and Port A[7:0] – row control.

Table 1 : MTK-85 IO I/O Devices

In this lab activity, students will be demonstrated on 1. How to display data onto the 7-segment LED 2. How to use the on board 28 keys keypad. 3. How to display data on LCD text display.

Page 4: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

3 UniMAP

LABORATORY TASK

Part A : INTERFACING THE 7-SEGMENT LED DISPLAY

Given below is a sample program on how to display a BCD numbers on a 6 digits 7-segment LED. Take note of the string of data sent to PORT B and Digit count to Port C Lower.

ORG 8100H LXI SP, 0FFF0H SYSPORTA: EQU 10H SYSPORTB: EQU 11H SYSPORTC: EQU 12H SYSPORTCTRL: EQU 13H sevseg: MVI A, 90H ;set Port A as input, Port B and C as output OUT SYSPORTCTRL SCAN1: MVI B, 00H SCANDISP: MOV A, B ;DATA OF 7SEG DIGIT COUNT ORI 0F0H ;FILTER OUT HIGH NIBBLES TO ENSURE ALL VALUES EQUAL 1(USE AS INP)

OUT SYSPORTC ;lOWER NIBBLE DATA IS USED TO SELECT 7 SEG DIGIT LXI H,DATA7SEG ;INITIATE STARTING ADDRESS OF 7 SEG DATA TABLE MOV A, B ; ADD L ; MOV L, A ; MOV A, M ; OUT SYSPORTB ;DISPLAY THE SELECTED DIGIT CALL DELAY ;STABILIZATION DELAY ORA A ;ZEROING ACC OUT SYSPORTB ;CLEAR THE DISPLAY CALL DELAY INR B ;INCREMENT 7 SEG DIGIT COUNT MOV A, B ; CPI 6 ;IF COUNT LESS THAN 6, CONTINUE OTHERWISE START ALL OVER JZ SCAN1 ;START NEW SCAN JMP SCANDISP ;CONTINUE TO NEXT DIGIT DELAY: LXI D, 00H DL1: DCR D JNZ DL1 RET ORG 0E000H DATA7SEG: DFB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,77H,7CH,39H,5EH,79H,71H

; “0”,”1”,”2”,”3”,”4”,”5”,”6”,”7”,”8”,”9”,”A”,”B”,”C”,”D”,”E”,”F”

As you can see, the Table at DATA7SEG defines 8-bit values data to illuminate the necessary LED segments to form a character.

Page 5: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

4

Part B : INTERFACING THE KEYPAD

The following sample program read keypad and display the keypad count number(ID) and its value. MTK-85 keypad system is different from others in term of identifying the pressed key. This system uses a bit counter value to identify which key is pressed. Port C control the keypad column and Port A control the keypad rows (input values). The keypad scanning is by the method of counting and the count value represent the key position on board. Since the keypad has 28 keys, the counter must counts at least up to 28. In this case, the system have 6 column and 8 rows in which it shares with the digit count control of seven segment LED display. The keypad uses ONLY 6 rows for column 1-4 while 8 rows in column 6 (refer Figure 1) . The counter is actually count from 0-47. The key position (count) map to the actual keys on keypad is shown in Table 2. The keypad scanning process starts with selecting a column. Port C lower nibble feed 4 bit data to the 4-to-10 decoder to select column 0-5 of the key pad. The selected column will be connected to 0V since the 4-to-10 decoder output is active low. Then row input is read through the Port A (pulled high). The obtained value will indicate which key in the column is pressed that is indicated by value 0 in the 8 bit data. The program searches value 0 in the 8 bit data while incrementing the counter. If value 0 found, the counter value will be saved to the memory. If not found, continue to the next column and repeat the same process. The counter will continue for all 6 column . It will only reset after 6 column were counted ( 47 counts). The scanning process is then repeat cointinously. The counter value that has been saved to memory each time of the scanning process is then used to get the actual key from the table. The key value can be displayed on seven segment LED digit display or use for input to any processing or command. The outcome of the sample program is shown in Figure 2.

Figure 1 MTK-85 keypad schematic

Page 6: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

5

Table 2: Keypad count (position) to key value mapping.

COUNT KEY COUNT KEY COUNT KEY COUNT KEY COUNT KEY COUNT KEY

0 F3 8 F4 16 F0 24 F1 32 NULL 40 NULL

1 F2 9 F5 17 F6 25 F7 33 NULL 41 NULL

2 0 10 1 18 3 26 NULL 34 NULL 42 NULL

3 4 11 5 19 7 27 NULL 35 NULL 43 NULL

4 8 12 9 20 B 28 NULL 36 NULL 44 NULL

5 C 13 D 21 F 29 NULL 37 NULL 45 NULL

6 NULL 14 NULL 22 NUL 30 NULL 38 NULL 46 F8

7 NULL 15 NULL 23 NUL 31 NULL 39 NULL 47 F9

Figure 2: Seven segment LED light up showing key position (Dig 3 & 4) and Key value (Dig 6)

Key count (position) Key value

Digit 1 Digit 2 Digit 3 Digit 4 Digit 5 Digit 6

Page 7: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

6

SYSTEM_PORT_A: EQU 10H SYSTEM_PORT_B: EQU 11H SYSTEM_PORT_C: EQU 12H SYSPORTCTRL: EQU 13H ORG 8100h LXI SP, 0F000H MVI A, 10010000B ;PORT A - INPUT; B,C - OUTPUT OUT SYSPORTCTRL MAIN: CALL SCAN LDA KEY ; Load newly pressed key data CPI 0FFH ; check if no key is pressed JZ NOKEY1 ; if no key, do not update key data, use last ;last key instead STA LASTKEY ; if new key is pressed, update last key ;pressed data. NOKEY1: LDA LASTKEY ;load key data from memory MOV D,A ; copy to D reg MVI A,3 ; Digit 3 ORI 0F0H OUT SYSTEM_PORT_C ;selected MOV A,D ;reload key data to Acc. CALL BCDthing ;convert BCD number MOV E,A ;copy converted data to E reg ANI 0FH ;Filter out upper nibble- first BCD digit LXI h,DATA ; Initialized data pointer MVI B,0 ; bc rp, initi b=0 MOV C,A ; put data to rg c DAD B ; 16 bit addition MOV A,M ; moving the 7 segment data from to acc.

;from memory to Acc OUT SYSTEM_PORT_B ; light up 7segment LED(first digit CALL DLYLAH MVI A,0 OUT SYSTEM_PORT_B ; Turn off display CALL DLYLAH MVI A,2 ; Digit 2 ORI 0F0H OUT SYSTEM_PORT_C ; selected MOV A,E ;get upper nibble data – second BCD digit

ANI 0F0H RRC RRC RRC RRC ;rotate 4 time to move to lower nibble

Page 8: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

7

LXI h,DATA ;initialized data pointer MVI B,0 ;reset B reg to 0 (BC Reg. Pair ) MOV C,A ;put BCD data to C reg (BC Reg. Pair) DAD B ; 16 bit addition HL & BC – get 7 seg data

;position in table MOV A,M ; copy 7seg data from memory to Acc. OUT SYSTEM_PORT_B ; display second digit CALL DLYLAH MVI A,0 ;a short blank of the display OUT SYSTEM_PORT_B ; CALL DLYLAH MOV A,D ;recopy key data to acc. CALL getkeycodez ;convert to actual character(Key Value),

; - converted value stored in b reg MVI A,5 ;Digit 5 ORI 0f0h OUT SYSTEM_PORT_C ;selected MOV A,B ;copy converted value to Acc OUT SYSTEM_PORT_B ;light up the (key value) character CALL DLYLAH MVI A,5 ORI 0F0H OUT SYSTEM_PORT_C MVI A,0 OUT SYSTEM_PORT_B ; a short blank the digit JMP MAIN ; repeat keypad scanning and lighting the ; 7 segment Display LED ; Shortd delay routine. DLYLAH: MVI C,0 loop13: DCR C JNZ loop13 RET

;Key value conversion routine ( Counter ;value to Key Value)

getkeycodez: LXI h,DATA ;Look upt table for the pressed ;key(based on the key position data) CALL get_key_code MOV C,A MVI B,0 DAD B MOV A,M MOV B,A RET

Page 9: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

8

BCDthing: PUSH psw PUSH B PUSH D PUSH h MOV E, A ; Store the contents of accumulator ANI 0FH ; Mask upper nibble CPI 0AH ; Check if number is greater than 9 JC SKIP ; if no go to skip MOV A, E ; Get the number ADI 06H ; Add 6 in the number JMP SECOND ; Go for second check SKIP: PUSH PSW ; Store accumulator and flag contents in stack POP B ; Get the contents of accumulator in B register and ; flag register contents in C register MOV A, C ; Get flag register contents in accumulator ANI 10H ; Check for bit 4 JZ SECOND ; if zero, go for second check MOV A, E ; Get the number ADI 06 ; Add 6 in the number SECOND: MOV E, A ; Store the contents of accumulator ANI 0F0H ; Mask lower nibble RRC RRC RRC RRC ; Rotate number 4 bit right CPI 0AH ; Check if number is greater than 9 JC SKIP1 ; if no go to skip 1 MOV A, E ; Get the number ADI 60H ; Add 60 H in the number JMP LAST ; Go to last SKIP1: JNC LAST ; if carry flag = 0 go to last MOV A, E ; Get the number ADI 60H ; Add 60 H in the number LAST: POP h POP D POP B POP psw RET

Page 10: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

9

;********************************************************************* ; subroutine scan keyboard and display * ; input: hl pointer to buffer * ; exit: KEY = scan code * ; -1 no key pressed * ;********************************************************************* SCAN: PUSH h ; save mem pointer hl PUSH B ; save reg air bc... PUSH D ; save reg pair de ..d reg was used for time

; OUT loop counter(25 loop) ;******************************************************************** ;scan process initialization * ;******************************************************************** MVI C,6 ; for 6-digit LED MVI E,0 ; digit scan code appears at 4-to-10 decoder MVI D,0 ; key position MVI A,0FFH ; put -1 to key STA KEY ; key = -1 scan1: MOV A,E ; set A to zero to start with digit 1 ORI 0f0h ; high nibble must be 1111 OUT SYSTEM_PORT_C ; active digit first MVI B,1 ;**************************************************** wait1: ; delay for transition process DCR B ; JNZ wait1 ;**************************************************** IN SYSTEM_PORT_A ; read input port to check if

;any key is pressed

Page 11: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

10

;********************************************************************* ; analyse the 8 bit data read from port a; all bits are pulled high initially, * ; therefore bit=0 mean a key is pressed * ;********************************************************************* MVI B,8 ; check all 8-row shift_key: RAR ; rotate right through carry JC next_key ; if carry = 1 then no key pressed PUSH psw ; save accumulator and flag

;register into stack MOV A,D ; copy position counter d to accum. STA KEY ; save key position and then

; continue to check the rest of bits

POP psw ; restore accumulator and flag register next_key: inr D ; next key position (Increment key count) DCR B ; until 8-bit was shifted JNZ shift_key ; end of the 8 bit checking

MVI A,0 ; clear a inr E ; next digit scan code(0,1,2,3,4,5)...

; 4/5 may not used DCR C ; next column(0-5) JNZ scan1 ; check keys in the next column ;finish scannig all keys ;key position has been saved to key buffer POP D POP B POP h RET ;******************************************************************** ; convert position key to internal key code 0-F for data entry * ; and 10-19H for function keys * ; entry: A = scan code * ; exit : A = internal code * ;******************************************************************** get_key_code: CPI 2 ; the saved key position is 2 JNZ code1 ; not 2 check next position MVI A,0 ; 2 is for key '0', return value 0 RET

Page 12: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

11

code1: CPI 0ah ; the saved key position is 0AH JNZ code2 ; not 0AH check next position MVI A,1 ; 0AH is for key '1', return value 1 RET code2: CPI 12h ;2 JNZ code3 MVI A,2 RET code3: CPI 1ah ;3 JNZ code4 MVI A,3 RET code4: CPI 3 ;4 JNZ code5 MVI A,4 RET code5:

CPI 0bh ;5 JNZ code6 MVI A,5 RET code6: CPI 13h ;6 JNZ code7 MVI A,6 RET code7: CPI 1bh ;7 JNZ code8 MVI A,7 RET code8: CPI 4 ;8 JNZ code9 MVI A,8 RET

Page 13: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

12

code9: CPI 0ch ;9 JNZ code10 MVI A,9 RET code10: CPI 14h ;A JNZ code11 MVI A,0ah RET code11: CPI 1ch ;B JNZ code12 MVI A,0bh RET code12: CPI 5 ;C JNZ code13 MVI A,0ch RET code13: CPI 0dh ;D JNZ code14 MVI A,0dh RET code14: CPI 15h ;E JNZ code15 MVI A,0eh RET code15: CPI 1dh ;F JNZ code16 MVI A,0fh RET code16: CPI 10h ; Function key 0 JNZ code17 MVI A,10h RET code17: CPI 18h ; Function key 1 JNZ code18 MVI A,11h RET

Page 14: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

13

code18: CPI 1 ; Function key 2 JNZ code19 MVI A,12h RET code19: CPI 0 ; Function key 3 JNZ code20 MVI A,13h RET code20: CPI 8 ; Function key 4 JNZ code21 MVI A,14h RET code21: CPI 9 ; Function key 5 JNZ code22 MVI A,15h RET code22: CPI 11h ; Function key 6 JNZ code23 MVI A,16h RET code23: CPI 19h ; Function key 7 JNZ code24 MVI A,17h RET code24: CPI 2eh ; Function key 8 JNZ code25 MVI A,18h RET code25: CPI 2fh ; Function key 9 JNZ code26 MVI A,19h RET code26: CPI 0eeh MVI A,14h RET

Page 15: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

14

code27: MVI A,0ffh RET ;******************************************************************* HLT ;******************************************************************** ; delay routine ;******************************************************************** dlyz: LXI H, 10FAH MVI E, 01H RST 1 RET ******************************************************************** ;ALLOCATE DATA SECTOR ORG 0e000h KEY: DFS 1 ; key position storage LASTKEY: DFS 1 ; last key storage ;********************************************************************* ;Seven segment LED display data * ;********************************************************************* DATA: DFB 00111111B, 00000110B, 01011011B, 01001111B;0,1,2,3 DFB 01100110B, 01101101B, 01111101B, 00000111B ;4,5,6,7 DFB 01111111B, 01101111B, 01110111B, 01111100B ;8,9, A,b DFB 00111001B, 01011110B, 01111001B, 01110001B ;C, D, E,F ;*********************************************************************

Page 16: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

15

Part C: INTERFACING LCD TEXT DISPLAY

The LCD text display in MK-85 is integrated directly to the 8085 processor as a device. Data pins of the LCD are connected directly to the data lines of the processor. The LCD’s RS and R/W signal lines are connected to the A0 and A1 of the processor’s address bus while LCD enable line is connected to output from memory and i/o address decoder. The sample program below presents how to display data on the LCD text display.

; ------------------- onboard LCD registers ----------------- command_write: equ 50h command_read: equ 52h data_write: equ 51h data_read: equ 53h busy: equ 80h ;-------------------------------------------------------------------- ORG 8100H CALL init_lcd LXI H,0000H CALL goto_xy LXI H,DATA1 CALL put_str_lcd check: LXI H,0001H CALL goto_xy LXI H,DATA2 CALL put_str_lcd CALL DELAY LXI H,0001H CALL goto_xy LXI H,CLEARDAT CALL put_str_lcd CALL DELAY JMP check HLT DELAY: MVI C,0C0H INL: MVI B,0FFH DLY1: DCR B JNZ DLY1 DCR C JNZ INL RET

Page 17: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

16

; --------------------- LCD driver routines ----------------- lcd_ready: push psw lcd_ready1: in command_read ani busy jnz lcd_ready1 ; wait until lcd ready pop psw ret clear_lcd: call lcd_ready mvi a,1 out command_write exit_clear: ret init_lcd: call lcd_ready mvi a,38h out command_write call lcd_ready mvi a, 0ch out command_write call clear_lcd ret ; print ASCII text on LCD ; entry: HL pointer with 0 for end of string put_str_lcd:

mov a,m ; get A from [HL] cpi 0 jnz put_str_lcd1 ret put_str_lcd1: call lcd_ready out data_write inx h jp put_str_lcd

Page 18: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

EKT222 Miroprocessor Systems Lab 5

17

; goto_xy set cursor location on lcd ; entry: HL: H = x, L = y goto_xy: call lcd_ready mov a,l cpi 0 jnz goto_xy1 mov a,h adi 80h out command_write ret goto_xy1: cpi 1 jnz goto_xy2 mov a,h adi 0c0h out command_write ret goto_xy2: cpi 2 jnz goto_xy3 mov a,h adi 094h out command_write ret goto_xy3: cpi 3 jnz goto_xy4 mov a,h adi 0d4h out command_write ret goto_xy4: ret put_ch_lcd: call lcd_ready out data_write ret DATA1: DFB 4DH,69H,63H,72H,6FH,50H,20H,53H

DFB 79H,73H,74H,65H,6DH,00H ; asci for”MicroP System” DATA2: DFB "System Ready!! ",0 ; CLEARDAT: DFB " ",0

Page 19: EKT 222 MICROPRESSOR SYSTEMportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · 2) Ability to use branching instructions 3) Ability to execute and demonstrate

18

EKT222 Miroprocessor Systems Lab 5

EXERCISE

1. Create a program that will display the BCD value of a 4-bit switch on a 7- the onboard 6 segment LED digit dispalay. You do not need to construct input switch. Assume input switch are given by the following value:

INPUT SWITCH VALUES: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

2. A BCD counter counts on every clock pulse represented by a delay. Write a program so that the counter will count on every clock pulse (a delay is called) and display the BCD counter on seven segment LED digit display.

3. Create a program that will blink an LED according to the count of the keypad value. For example if the key ‘5’ is pressed, then the LED will blink 5 times after the key button is pressed.

4. Create an up-down BCD counter with the following sequence : 0 -> 1 -> 2 -> … -> 8 -> 9 -> 8 -> 7 -> … -> 2 -> 1 -> 0

5. Create a program that will store 4 digits in memory and then display the digits in sequence on a 7-segment LED.

6. Using 2 push-pull switches, create a program that will fulfill the following operation :

a. 00 the 7-segment displays ‘0’ only b. 01 the 7-segment will do a BCD continuous up count c. 10 the 7-segment will do a BCD continuous down count d. 11 the 7-segment will pause counting