You are on page 1of 8

Laboratotry D4 Report

Micro Processor – Pt1

Course – MTRN3200 (Elements of Mechatronic Systems)


Eric Uyemura Suda – z5031324
Lucas Mattos – z5031159
Diogo dos Santos - z5050742
Contents
Introduction .................................................................................................................................................. 1
Experimental Results .................................................................................................................................... 2
1) Flow Chart ............................................................................................................................................. 2
Conclusion ..................................................................................................................................................... 5
Bibliography .................................................................................................................................................. 6
Introduction
Microprocessors, as an entire CPU stored in most of the times one, or more, ICs, are compact devices
that accepts digital inputs, processes them in their memory and provide feedback. This minimization of
the circuit can drastically reduce the processing power and making it more viable economically as they
can be produced in large scale and are relatively cheap. Having being used in a multitude of applications
and embedded systems their versatility substituted any other form of computer hardware.
Microprocessors can be controlled by a user written program which has the IC to gather all of the
necessary resources and store it inside of one of its registers. The model used in this lab is the
ATmega16 from the Atmel AVR line which is programmed utilizing a similar language to C. (Kwok, n.d.)

1
Experimental Results

1) Flow Chart
The functioning of the LED shifter code is as explained below:

Flowchart 1 - Main function

As the main function starts, the timer/counter is initialized through init_mtrn3200() that sets the
frequency this 16-bit counter will operate, then at each reset of it, when the previously set limit value is
reached (each 1 second) a interrupt handler (ISR) will enable the LED shift flag that is read in the
condition inside the main loop, then the flag is disabled and the LED shifting is performed on
shift_light_to_left().

The pieces of code that represents the latter explanation are shown below:

Figure 1 - Infinite loop

2
Figure 2 - Interrupt handler for timer 3

The LED shifting function is as follows:

Figure 3 - LED shifting

Overall, this method checks the current value from the LEDs on PORT H. In the beginning the
condition that checks if this value equals 0 set its initial value as 0x01 (representing the last on the right
ON), in the same way it’s done when the value is higher or equal than 0x80 (representing the last LED on
the left ON), otherwise, if 0x80 > LEDs value > 0x00 then it just shift the currently ON LED by bitshifting
the currently read value by 1 in the left direction, and writing it.

The code that executes this operation is the following:

3
Figure 4 - LED shifting function

4
Conclusion

5
Bibliography

Kwok, N. M., n.d. Moodle UNSW - MTRN3200 - Lecture Notes. [Online]


Available at: http://moodle.telt.unsw.edu.au/

You might also like