Question: Project 3 Looping Reading assignment: Please do this very thoroughly since the info here is critical: Data Sheet: pages 40-41 and at the back explanations

Project 3 Looping Reading assignment: Please do this very thoroughly since the info here is critical:

Data Sheet: pages 40-41 and at the back explanations for instructions: DECFSZ,

DECF,BNZ,COMF - Notes in class are critical Finally SKIM: Book Chap. 2,3,4 (emphasis on 2.6, 2.7, 3.8,3.9), 5.7

Use LoopTime whose details have not yet been discussed in class. It provides you with a 10msec delay of the processor whenever you call it. The assignment is about using basic concepts learned in class to create subroutines and processor delays.

Create two counters BIG_Counter & Small_Counter with initial values of 0 and 128 respectively. The programs flow will be controlled from a toggle switch in the CADET which will be connected to pin RE2 on the PIC board. Each time the toggle switch is set the following should happen:

The numbers are added (with no carry)

The BCD representation of the upper nimble 4-bits is displayed on the seven-

segment display that will be provided

A delay of 1 second is created

The BCD representation of the lower nimble 4-bits is displayed on the above

seven-segment display

A delay of 3 seconds is created

The seven-segment display is turned off (reset)

BIG_COUNTER increments by one

SMALL_COUNTER moves to the next (smaller) power of 2 (ie. from 128 to 64

to 32 etc)

PROGRAM THEN REPEATS THE ABOVE DISPLAY INDEFINITELY

Also, when counters recycle, ie. when BIG_COUNTER is back to 0 and SMALL_COUNTER gets back to 128 then ALIVE LED flashes for 1 second and the program continues.

As long as the toggle switch is set the above keeps repeating. The process halts only when the toggle switch is brought back to zero and it continues where it was left off when the toggle switch is set again

NOTE1: you should write your program using as many subroutines as possible so that it has a good structure. Choose the proper 4-pins for the output (that input to the seven- segment display) according to your discretion and based on what we learned so far including the lab we did in session 1. Suggested output pins are: B2 ...B5

NOTE2: Test each subroutine separately. DO NOT WRITE THE WHOLE PROGRAM AND THEN TRY TO DEBUG IT. YOU WILL NOT BE VERY SUCCESSFULL!! NOTE3: Make a little table with the numbers that are being added and the result. That way when you debug your program, you are able to see what is happening. Show at least 7 numbers as an example on paper.

NOTE4: You will need the daw command for BCD so either read about it or take notes in class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!