Introduction to Smart Systems Laboratory task



Download 7.81 Kb.
Date22.07.2017
Size7.81 Kb.
#23785
Introduction to Smart Systems

Laboratory task (basic I/O skills and debugging practice)
This lab task is designed to encourage exploration of the basic I/O capabilities of the microcontroller, as well as practice using the ATMEL Studio 6 development tool. There is some overlap with the previous task – this is to reinforce the fundamentally important core skills needed for the remainder of the course.
You should use the run-time debugging facilities of the Dragon to examine the behaviour of your code and to help you to find any logical errors you may have.
By the end of this lab activity you should be capable and confident using the core equipment for the course – the STK300 board with ATmega1281 microcontroller, the Dragon board and Atmel Studio 6. You should also be able to understand and write programs in both assembler and embedded C.

Part A – Use assembly language
1. Use the assembly language ‘skeleton project’ supplied on the resources website. This forms a basis for you to develop the solutions to this lab task: it provides a basic working configuration of the microcontroller.

(Hint, also look at the ‘Switches and Lights’ sample code to get further clues if you get stuck)


2. Write, assemble and execute a simple program to count the number of times switch 0 (the leftmost one) on the ‘Switches and LEDs unit’ is switched on and off. Each time the switch is set to on and then off, the count should increase by one.
(Note. You can use the on-board switches instead of the external ‘Switches and LEDs unit’ but the on-board switches are not ‘debounced’ – this means that a single press by you may cause several actual switch open-close-open actions to occur very quickly, and in this case your program may count a single press as several presses.)

2A. You can create a simple software debouncer by simply adding a delay of about 1/10th second into the main loop so that the switches are not examined too frequently, giving time for the bounces to die away between presses)


3. Display the count value on the LEDs.
4. Modify the program so that when the count gets to 20 the value is set back to 0 and the display is cleared.
5. Modify the program so that when the count gets to 10 the whole row of LEDs are flashed on (for 1 second) and off again (back to the value 10, so counting can continue).
6. Modify the program so that when switch 7 (the leftmost one) is pressed the count should be reset to 0 and the LED display updated accordingly.

Part B – Repeat part A, this time using embedded C

(Use the embedded C ‘skeleton project’ as a starting point)




Richard John Anthony, Smart Systems Technology, The University of Greenwich , UK


Download 7.81 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page