Вы находитесь на странице: 1из 5

Dr.

Hoganson

7-Segment Display and Count by 16

CSIS 4381

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 7segment LED display. You will need a floppy diskette to hold your programs, for later printing.

Dr. Hoganson

Lab Preparation A: simp3v2.asm

CSIS 4381

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 7segment 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

MODIFIED simp2v2.asm

CSIS 4381

**************************************************************** *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/memory port_a equ rbase+0 ;port A is the first register h_sec equ $ffff ;delay loop value (about 1/2 second) **************************************************************** begin: ldaa staa lds loop: ldaa staa bsr clr bsr bra #$04 $3f #$ff #$40 port_a delay port_a delay loop ;value to disable timed interrupt ;disables the timed interrupt ;set stack start ;write logic high to PA6 (turn on LED) ;$0 is location of Port A ;clear PortA Continued next slide

Dr. Hoganson

MODIFIED simple2.asm

CSIS 4381

**************************************************************** * delay loop subroutine **************************************************************** delay: ldy #h_sec ;delay loop (about 1/2 second) dloop: dey iny ;extra iny,dey add delay time dey bne dloop rts ****************************************************************

org fdb

$fffe begin

;define the reset vector to point to start of program ;begin is the start of the program

Dr. Hoganson

Part B: The Lab

CSIS 4381

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 7seg 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.

Вам также может понравиться