Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

its a code to prepare led psb, Summaries of Embedded Systems

skibidi di di did skibidi skibdi

Typology: Summaries

2023/2024

Uploaded on 09/23/2024

shivam-faker
shivam-faker 🇮🇳

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PA: EQU 80H ;PORT A
PB: EQU 81H ;port B
PC: EQU 82H ;port C
CR: EQU 83H ;control register
ORG 0000H
JMP START
ORG 0024H
RET
START:
LXI SP,2010H
MVI A,90H
OUT CR ;configure the ppi
MVI A,00H
OUT PB
MVI A,00H
XRI 01H
MAIN:
CALL PSB_SCN
JMP MAIN
PSB_SCN: ;function for scanning psb
MVI C,00H ;counter for psb scan index
IN PA ;first scanning instant
ORI 00H ;check if button is pressed or not
JZ START ;jump to start if no switch pressed
MOV D,A
CALL DLY20MS ;call delay
IN PA
CMP D ;check valid press
JNZ RT_PSB
X: ;generate psb index
INR C
RAR
JNC X
CALL DISP
DISP: ;function for 7s diplay
LXI H,TABLE ;initialize M with lut address
MOV A,C
SUI 01H
ADD L ;add index to M value
MOV L,A
MOV A,M
OUT PB
RET
DLY20MS: ;DELAY function
pf2

Partial preview of the text

Download its a code to prepare led psb and more Summaries Embedded Systems in PDF only on Docsity!

PA: EQU 80H ;PORT A

PB: EQU 81H ;port B PC: EQU 82H ;port C CR: EQU 83H ;control register

ORG 0000H JMP START

ORG 0024H RET

START:

LXI SP,2010H

MVI A,90H

OUT CR ;configure the ppi MVI A,00H OUT PB MVI A,00H XRI 01H

MAIN: CALL PSB_SCN JMP MAIN

PSB_SCN: ;function for scanning psb MVI C,00H ;counter for psb scan index IN PA ;first scanning instant ORI 00H ;check if button is pressed or not JZ START ;jump to start if no switch pressed MOV D,A CALL DLY20MS ;call delay IN PA CMP D ;check valid press JNZ RT_PSB X: ;generate psb index INR C RAR JNC X CALL DISP

DISP: ;function for 7s diplay LXI H,TABLE ;initialize M with lut address MOV A,C SUI 01H ADD L ;add index to M value MOV L,A MOV A,M OUT PB RET

DLY20MS: ;DELAY function

MVI B,04H

DLP20:DCR B

JNZ DLP

RET

RT_PSB:

RET

TABLE:

DFB 3FH, 06H, 5BH, 4FH

DFB 66H, 6DH, 7DH, 07H