Download presentation
Presentation is loading. Please wait.
Published byDrusilla Baldwin Modified over 9 years ago
1
ECE 265 – LECTURE 17 Simulator Project 8/7/2015 1 ECE265
2
Simulator Project Overview of the project Some specific items to note 8/7/2015 2 ECE265
3
Step 1 of the project – the setup Start up THRSIM Open a new code window You will have a 2 digit 7 segment display to display the A register You also need a switch. Connect it to pin PC0. Connect a 2 nd switch to PC1. 8/7/2015ECE265 3
4
Step 2 Write code that does the following The switch on PC0 is the count ON/OFF switch. When it is OFF the counter does not run. When it is ON, the counter runs. (ON = 1) The switch on PC1 is the count up/count down switch When it is OFF, the counter counts up. When it is ON, the counter counts down (ON = 1) The byte display of the A accumulator shows the count. The display be in decimal, so count in BCD. 8/7/2015ECE265 4
5
BCD adjustment When counting up – what adjustment is needed in BCD? Currently at $19 – do an INCA – what do you get? Get a $1A but want $20 When counting down – what adjustment is needed in BCD? Currently at $20 – do an DECA – what do you get? Get $1F but want $19. Do a DAA and get $25 How to solve? Must look at each digit of the two independently. 8/7/2015ECE265 5
6
Incorporate your delay subroutine You wrote a routine to introduce delay Incorporate that routine that the counts occur at approximately 1 second intervals 8/7/2015ECE265 6
7
Sim Proj 2 – extra credit Modify your code from Sim Proj 1 to add the following Add a second 2 digit 7 segment display, this time to port B. Use it and the display from the A accumulator to display time in a 12 hour format. To stay in the 12 hour format the minutes (A accumulator) will count to 59 and then roll over to 00, incrementing the hour. The run button will be modified to a set function. When pressed the hours or minutes will be adjusted. The up/down button will be used to select minutes or hours to set. When running you will only increment the minutes digit every minute in a real application. For this assignment and to allow testing have it change every 3 to 4 seconds. You can do this by writing a new subroutine for this delay that calls the previous delay routine a number of times. 8/7/2015ECE265 7
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.