Question

In: Electrical Engineering

Question: How to delay this code from 1 second delay to 0.5 second delay? org 0000h;...

Question: How to delay this code from 1 second delay to 0.5 second delay?

org 0000h;

ljmp main;

org 0050h;

main:

     mov dptr,#SMG_DUAN ;

    mov r0,#00h;

    mov r1,#0ah;

lin1:mov a,r0;

    movc a,@a+dptr; get first indexed data in rom to accumolator a

    mov p1,a; move data in a to port 1

    lcall delay; subroutine call for the delay

    inc r0; increase r0 by one to get to the next index

    djnz r1,lin1; repeat the above instructions till we get all the data

    sjmp main;

delay:

mov r3,#0fh; move 0fh to regester 3

lin2: mov r4,#0ffh; mov 0ff to reginster 4

lin3: mov r5,#0ffh; move 0ff to register 5

djnz r5,$; decrease r5 till it equal to 0

djnz r4,lin3; decrease r4 till it equal to 0

djnz r3,lin2; decrease r3 till it equal to 0

ret

org 0200h

SMG_DUAN: ; rom memeory

   db 0c0h,0f9h,0a4h,0b0h,99h,92H,82h,0f8h;

   db 80h,90h,88h,7ch,39h,5eh,79h,71h;

   end

Solutions

Expert Solution

In the delay block instead of moving 0FH to registers, move half the value which is 08H and decrement these values to 0 so that the delay will become half of the earlier.

org 0000h;

ljmp main;

org 0050h;

main:

     mov dptr,#SMG_DUAN ;

    mov r0,#00h;

    mov r1,#0ah;

lin1:mov a,r0;

    movc a,@a+dptr; get first indexed data in rom to accumolator a

    mov p1,a; move data in a to port 1

    lcall delay; subroutine call for the delay

    inc r0; increase r0 by one to get to the next index

    djnz r1,lin1; repeat the above instructions till we get all the data

    sjmp main;

delay:

mov r3,#08h; move 0fh to regester 3

lin2: mov r4,#08fh; mov 0ff to reginster 4

lin3: mov r5,#08fh; move 0ff to register 5

djnz r5,$; decrease r5 till it equal to 0

djnz r4,lin3; decrease r4 till it equal to 0

djnz r3,lin2; decrease r3 till it equal to 0

ret

org 0200h

SMG_DUAN: ; rom memeory

   db 0c0h,0f9h,0a4h,0b0h,99h,92H,82h,0f8h;

   db 80h,90h,88h,7ch,39h,5eh,79h,71h;

   end


Related Solutions

Hi, I'm trying to rewrite the code below (code #1) by changing delay() to millis(). void...
Hi, I'm trying to rewrite the code below (code #1) by changing delay() to millis(). void loop() { // Print the value inside of myBPM. Serial.begin(9600); int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int". // "myBPM" hold this BPM value now. if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened". Serial.println("♥ A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened". Serial.print("BPM:...
HOW TO CODE AND SEQUENCE THE FOLLOWING: 1.ASSESSMENT: DKA, TYPE 1DM Tip: ASSIGN A SECOND CODE...
HOW TO CODE AND SEQUENCE THE FOLLOWING: 1.ASSESSMENT: DKA, TYPE 1DM Tip: ASSIGN A SECOND CODE FOR UNDERDOSING OF INSULIN FROM THE TABLE OF DRUGS AND CHEMICALS. 2. ASSESSMENT: TEST RESULTS SHOW ABNORMALLY LOW VITAMIN D LEVEL. PATIENT IS OBESE DUE TO EXCESS CALORIES AND HAS A (BMI) OF 30.5 KG/M2 TIP: Z CODE FOR ANNUAL CHECKUP IS NEEDED.
Using vhdl in a FSM , how could you write code to delay a state change...
Using vhdl in a FSM , how could you write code to delay a state change for one hour? For example, you have a fan running in the 'on' state , but after 1 hour you would like that fan to switch back to the 'off' state. What is the best way going about doing this?
A 0.5-kg rock is thrown with a velocity of 6 meters per second from a height...
A 0.5-kg rock is thrown with a velocity of 6 meters per second from a height of 10 meters. What is the total energy? (Use g=10 m/s2. The answer will be in joules, but you DO NOT NEED to write the units
Microprocessor question Q1: Write a delay loop which produces a delay of 500 Microseconds on an8086...
Microprocessor question Q1: Write a delay loop which produces a delay of 500 Microseconds on an8086 with a 5-MHz clock.?
1) why is the difference between an avoidable delay and an unavoidable delay important to a...
1) why is the difference between an avoidable delay and an unavoidable delay important to a contractor? 2) What is the difference between a calender day and a working day? 3) Why would it be necessary and desirable to perform resource leveling for a construction schedule? 4) In which parts of a schedule should a contractor share the most detail with an owner? 5) As a contractor, what concern would you have regard cost and productivity if an owner directed...
A study investigated the relationship between audit delay (Delay), the length of time from a company's...
A study investigated the relationship between audit delay (Delay), the length of time from a company's fiscal year-end to the date of the auditor's report, and variables that describe the client and the auditor. The independent variables are as follows. Industry A dummy variable coded 1 if the firm was an industrial company or 0 if the firm was a bank, savings and loan, or insurance company. Public A dummy variable coded 1 if the company was traded on an...
A study investigated the relationship between audit delay (Delay), the length of time from a company’s...
A study investigated the relationship between audit delay (Delay), the length of time from a company’s fiscal year‐end to the date of the auditor’s report, and variables that describe the client and the auditor. Some of the independent variables that were included in this study follow: (12 marks total) Industry A dummy variable coded 1 if the firm was an industrial company or if the firm was a bank, savings and loan, or insurance company Public A dummy variable coded...
Please provide R-code for the following question: The second argument to `split` can be a list...
Please provide R-code for the following question: The second argument to `split` can be a list of factors. The result is that all interactions (possible combinations) are used for the groups. In the `ToothGrowth` data set, growth (`len`) is measured for two types of supplements (`supp`) and three doses (`dose`). Split this `len` value into 6 groups.
Serial.flush() and Delay() are the two built-in functions. Place them in the following code to remove...
Serial.flush() and Delay() are the two built-in functions. Place them in the following code to remove the garbage data printing as discussed in class. Code: char data; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: while(Serial.available()==NULL){ data = Serial.read(); Serial.print("given character is: "); Serial.println(data); } Serial.end(); }
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT