7-segment display and count by 16
DESCRIPTION
7-Segment Display and Count by 16. This is our third lab using the 68HC11 microcontroller. We will write a program that counts by 16 in a loop, using one of the registers to count in. Port A will display the count, and will be connected to the 7-segment LED display. - PowerPoint PPT PresentationTRANSCRIPT
Dr. Hoganson CSIS 4381
7-Segment Display and Count by 16
This is our third lab using the 68HC11 microcontroller.
We will write a program that counts by 16 in a loop, using one of the registers to count in. Port A will display the count, and will be connected to the 7-segment LED display.
You will need a floppy diskette to hold your programs, for later printing.
Dr. Hoganson CSIS 4381
Lab Preparation A: – simp3v2.asm
1. Examine simp2v2.asm to determine how the LEDs are being controlled in the loop.
2. Determine the changes needed to modify the program, so that Port A will contain and display the contents of a register (bits 4,5,6 on pins 4,5,6).
3. Determine the changes needed to make your register count up by 16s.
4. Since you will be displaying only 3-bits (4,5,6) of an 8-bit number in the register, explain in your notebook, how counting by 16 will work and what it will show on the 7-segment LED.
5. During the lab, you will edit and modify a copy of simp2v2.asm to create count-16.asm. You will assemble count16.asm and download it into the MicroStamp board, for execution and testing.
Dr. Hoganson CSIS 4381
MODIFIED simp2v2.asm
*****************************************************************file: simp2v2.asm*This program illustrates flashing PA6..*Dr. Hoganson, 10/2/02****************************************************************
org $e000 ;beginning of EEPROM (68HC811E2)rbase equ $0000 ;beginning of register/memoryport_a equ rbase+0 ;port A is the first registerh_sec equ $ffff ;delay loop value (about 1/2 second)****************************************************************
begin:ldaa #$04 ;value to disable timed interruptstaa $3f ;disables the timed interruptlds #$ff ;set stack start
loop: ldaa #$40 ;write logic high to PA6 (turn on LED)staa port_a ;$0 is location of Port Absr delayclr port_a ;clear PortAbsr delaybra loop
Continued next slide
Dr. Hoganson CSIS 4381
MODIFIED simple2.asm
***************************************************************** delay loop subroutine****************************************************************delay:
ldy #h_sec ;delay loop (about 1/2 second)dloop: dey
iny ;extra iny,dey add delay timedeybne dlooprts
****************************************************************
org $fffe ;define the reset vector to point to start of programfdb begin ;begin is the start of the program
Dr. Hoganson CSIS 4381
Part B: The Lab
Record in your lab notebook, your observations for each of the following steps.
1. Wire the 68HC11 as we did in the last lab, with power and ground, and LEDs connected to Port A bits 4,5,6.
2. Wire three PortA outputs to the inputs to the decoder for the 7-segment display. Also wire a ground from one of the 7-seg displays.
3. Verify correct operation by running the demo program, but also checking the wiring to the 7-segment display.
4. Edit, assemble, download, and test your count16.s19 program, and verify correct operation.
5. You will need to save your program on your floppy diskette, and print out a listing of each program, which you will insert into your lab notebook.