Question

Use assembly instruction decfsz and other associate instructions to create delays for the generation of a 500Hz tone continuo

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:- The 500 Hz has time period equal to 2 ms. Thus high time is of 1 ms and low time is of 1 ms. The count for 1 ms delay is-

n = 0.001 * 4000000/4 = 1000

The PIC18F assembly code is written below-

Count1 EQU 0x70 ;at address 0x70 Count1 variable is defined
Count2 EQU 0x71 ;at address 0x71 Count2 variable is defined

BCF TRISC, 5 ;make port C pin 5 as output

Loop:
BSF PORTC, 5 ;set port C bit 5
CALL Delay ;call the delay subroutine
BCF PORTC, 5 ;clear the bit 5
CALL Delay ;call the delay subroutine
GOTO Loop ;Loop the same thing infinitely

Delay:
MOVLW 0x05 ;W = 5
MOVWF Count2 ;Count2 = 5
Repeat:
MOVLW 0xC8 ;W = 200
MOVWF Count1 ;Count1 = 200
Here:
DECFSZ Count1 ;decrement the value of Count1 and skip next line if Count1 is zero
GOTO Here ;go to label Here
DECFSZ Count2 ;decrement the value of Count2 and skip next line if Count2 is zero
GOTO Repeat ;go to label Repeat
RETURN ;return to next of the subroutine call

Add a comment
Know the answer?
Add Answer to:
Use assembly instruction decfsz and other associate instructions to create delays for the generation of a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program to evaluate the arithmetic expression: (25xy - 10x - 6y + 28)/7 Use...

    Write a program to evaluate the arithmetic expression: (25xy - 10x - 6y + 28)/7 Use symbolic addresses x, y, answer, and remainder. Pick two registers for x and y and load them from memory. At the end of the program, store the answer and remainder to memory. Assume that the values are small enough so that all results fit into 32 bits. Since load delays are turned on in SPIM be careful what instructions are placed in the load...

  • I need help with doing these tasks for code composer Lab 3 - Branching, Push Button...

    I need help with doing these tasks for code composer Lab 3 - Branching, Push Button and LEDs-Reading Assignment in this lab, we are going to control a LED via a push button- using general purpose digital 10 for both input (button) and output (LED) on port 1 - using Code Composer Studio. Furthermore, we are going to use a branch instruction to create an IF-ELSE structure in assembly to determine if the LED should be lit up based on...

  • Create and Analyze a Process Flowchart A flowchart is a graphic representation of how a process works. For performance...

    Create and Analyze a Process Flowchart A flowchart is a graphic representation of how a process works. For performance improvement purposes, a flowchart helps people clarify how things are currently working and how they could be improved. In this project you'll create a flow chart for a work process and identify opportunities for improving the efficiency of the process. Hint: Look at each step in the process and ask yourself these questions: Does the step wasted time? Does the step...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

  • 10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated...

    10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT