14
Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run a demo program, and cause LED lights to blink. You microcontroller may have been reprogrammed by students last year. If that is the case, you will need to reload the demo program from disk to the microcontroller.

Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Embed Size (px)

Citation preview

Page 1: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

68HC11 Demo Program

This is our first lab using the 68HC11 microcontroller.

We will “talk” to the microcontroller from a PC, run a demo program, and cause LED lights to

blink.

You microcontroller may have been reprogrammed by students last year. If that is the case, you will need to reload the demo program from disk to the microcontroller.

Page 2: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Overview of the Lab

• The 68HC11 comes loaded with a demo program in EEPROM, that we will play with in the lab.

• EEPROM is Electrically Erasable Programmable Read-Only Memory.

• The demo program allows the user to communicate with the 68HC11 from a terminal program on the PC, over a serial connection.

• The demo program allows the user to toggle (reverse) three bits of one of the output ports (port A).

• We will connect those three bits of port A to LEDs on the IDL-800 Digital Lab

• We will verify operation of the board and demo program.

Page 3: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Part A, powering the MicroStamp11

1. The MicroStamp11 has a demo program already programmed into the EEPROM when you receive it. This is a useful program for testing your communications setup and monitoring and controlling the various I/0 lines of the micro.

2. Plug the MicroStamp11 into the Docking Module (may already be plugged in), and supply power via the external power connector. (See diagram on the next page.)

3. Connect a DC voltage greater than 5.6 Volts to the external power connector (J1) on the Docking Module. Red is positive, and black is negative (ground). CAUTION! Make sure you have the polarity correct!

4. Turn on the IDL-800. The LED on the MicroStamp11 should blink twice. Notify your instructor if it does not, and complete part A2.

5. Turn off the IDL-800 power.

Page 4: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Power

Reset

Output

Communication to PC

Page 5: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Power LED (Yellow)

D2 LED(RED)

Page 6: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Note: Correct Switch Positions to run the demo program

SW2: RUNBOOT

SW3: WRITEPROT

Page 7: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

PART A-2 Downloading the Demo Program

• Complete this set of steps if your microcontroller does not run the demo program on boot-up.

1. Connect the serial cable between the Docking Module and a serial port on your PC. (With some PCs, you will need a 9-pin to 25-pin adapter.)

2. Obtain a 68HC11 Utilities floppy disk.3. Insert the floppy disk, and open a DOS window.4. Change to the A: drive, and to a subdirectory

called mstamp11.5. At the DOS prompt,

• type PMS1 MS11DEMO6. Follow the instructions on the screen. To Set the

RUN/BOOT switch (SW2) to boot, and the WRITE/PROT switch (SW3) to write, see the previous slide.

Page 8: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Part B: The Terminal Connection to the 68HC11

1. To use the demo program, connect the supplied serial cable between the Docking Module and a serial port on your PC. (With some PCs, you will need a 9-pin to 25-pin adapter.)

2. Run the WindowsTerminal program (HyperTerminal, under Accessories) on your PC.

3. Configure your terminal program:4. set the baud rate to 9600 5. parity to NONE6. # DATA BITS = 87. #STOP BITS = 1. 8. Ensure that SW2 is set to RUN. (see diagram next page)9. Power on the IDL-800.10.Press the Docking Module RESET button. LED DI will blink twice,

indicating the demo programming is running. 11.Press <ENTER> on your keyboard. 12.A menu of commands will appear on your terminal window's

screen, followed by a command prompt '?‘ symbol. 13.Each command is activated by a single keystroke. 14.A sample screen showing results of each command is shown in

the following page.

Page 9: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Page 10: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Page 11: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Part C: The Demo Program

Typing a command not listed will cause the menu to be re-displayed.

The A and D commands in the demo program allow you to examine the states of PORTA and PORTD. We will work with PORTA.C – will clear the upper 5 bits of PORTA (leaving a

binary 3)A – will display the bits of PORTA as a decimal number.

We have to convert the number to binary to see what bits are set.

4,5,6 – will toggle bits 4,5, or 6 respectively.1. Enter A to see the state of PORTA.2. Enter C to clear PORTA.3. Enter A to see the state of PORTA.4. Enter 4 to toggle bit 4 or PORTA.5. Enter A to see the state of PORTA.6. Confirm that the correct bit was set, by converting

PORTA to a binary number.

Page 12: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Part D: Wiring the MicroStamp11 to LEDs

1. Turn OFF the IDL-800.2. Locate pins 4,5, and 6 on the MicroStamp docking

module.3. Connect a wire from each pin to the appropriate LED

light on the IDL-800.4. Turn on the IDL-800.5. Clear PORTA.6. Toggle Bit-4. Observe the LED.7. Display PORTA. Correct binary value?8. Toggle Bit-5. Observe the LED.9. Display PORTA. Correct binary value?10.Toggle Bit-6. Observe the LED.11.Display PORTA. Correct binary value?12.Turn OFF the IDL-800

Page 13: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Output Pins

Page 14: Dr. Hoganson CSIS 4381 68HC11 Demo Program This is our first lab using the 68HC11 microcontroller. We will “talk” to the microcontroller from a PC, run

Dr. Hoganson CSIS 4381

Speaker Output

Read Only: we do not have a speaker available.In the demo program, PA6 is used as a tone output for a

speaker. It is also connected to LED DI, when plugged into the

Docking Module, to provide a visual output. You can drive a small piezo speaker directly by hooking

one end to PA6 through a 330-Ohm resistor, and the other end to ground.

When you press RESET, or type 'S‘ when the demo program is running, you will hear two beeps from the speaker.