Professional Documents
Culture Documents
1
Experimental Results
1) Flow Chart
The functioning of the LED shifter code is as explained below:
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:
2
Figure 2 - Interrupt handler for timer 3
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.
3
Figure 4 - LED shifting function
4
Conclusion
5
Bibliography