70 likes | 151 Views
ECE 265 – Lecture 17. Simulator Project. Simulator Project. Overview of the project Some specific items to note. 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
E N D
ECE265 ECE 265 – Lecture 17 Simulator Project
Simulator Project • Overview of the project • Some specific items to note ECE265
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 2nd switch to PC1. ECE265
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. ECE265
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. ECE265
Incorporate your delay subroutine • You wrote a routine to introduce delay • Incorporate that routine that the counts occur at approximately 1 second intervals ECE265
Sim Proj 2 – extra credit • Modify your code from SimProj 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. ECE265