Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do the code as assembly language. It is really just a modification of the code. Thanks for answer my question. this is the question:

Please do the code as assembly language.

It is really just a modification of the code.

Thanks for answer my question.

this is the question:

The timer interrupt controls the sampling rate (this can be approximate) and you can select a XTAL frequency that may be easier to use than 20 MHz if you wish. Also, note that you can load the timer with a value after each interrupt instead of counting from 0 to 255/FF.

All you do is (near the start of the timer interrupt code) move a value into W and then move that to TIMER 0 (register address).

So instead of counting from 0 to FF and overflowing you would count from -XY (a minus number twos complement - the assembler handles that).

Thus, between the XTAL value, the pres-caler and the loaded value you can get close to any sampling rate, say 1 millisecond.

State in the code/submission document the system clock frequency used and the sampling rate.

Just add the code to the program from blow, the code is made by the question. I have no idea how to made the code.

Thanks

;===================================================================

FILTER movf S1,w ; Get sample 1

movwf OUT ; Put in output byte

bcf STATUS,C ; Zero Carry-in

rrf OUT,f ; Divide by two

movf S0,w ; Get sample 0

movwf TEMP,f ; Put into temporary location

bcf STATUS,C ; Again zero Carry-in

rrf TEMP,f ; Divide by two

bcf STATUS,C ; Again zero Carry-in

rrf TEMP,w ; Divide by two again to give divide by four

addwf OUT,f ; Add to sub total

movf S2,w ; Get sample 2

movwf TEMP,f ; Put into temporary location

bcf STATUS,C ; Zero Carry-in

rrf TEMP,f ; Divide by two

bcf STATUS,C ; Zero Carry-in

rrf TEMP,w ; Divide by two to give divide by four

addwf OUT,f ; Add to sub total

movf S1,W ;shift values in the array

movwf S2 ;S1-->S2

movf S0,W ;

movwf S1 ;S0->S1

; THE S0 SAMPLE SHOULD BE

; 'PASSED' AS A PARAMETER WHEN THE ROUTINE IS CALLED

; SEE BELOW

RETURN

movf ADCMSB,w ;REMEMBER THE RESULT FROM AD SHHOULD BE

movwf S0 ; LEFT ALIGNED...IN THE VIDEO AND ABOVE IT IS RIGHT ALIGNED

call FILTER

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions