Question: Write a program for the Dragon12 board that will utilize the HCS12 parallel ports to read a configuration setting from the on-board DIP switches and

Write a program for the Dragon12 board that will utilize the HCS12 parallel ports to read a configuration setting from the on-board DIP switches and control LED's triggered by the real-time interrupt.

The program will use the on-board DIP switches and the realtime interrupt (RTI) to flash the LEDs driven by pins PB0~PB7 of Port B.

When executed, the program will first scan the configuration of the on-board DIP switches (the switches are set by the user prior to executing the program). If the switch number 1 is set to 1 and others are 0, the configuration is interpreted as SHIFT LEFT. If the switch number 8 is set to 1 and others are zero, the configuration is interpreted as SHIFT RIGHT. All other switch combinations will yield an ALL configuration setting. The configuration scan is performed only once upon starting the program, later reconfiguration of the switches will have no effect on the function.

After the initial DIP switch scan is completed, for the SHIFT LEFT/RIGHT settings, the program will produce a moving light effect where one LED is turned on at a time (emitting light) for approximately 0.5 seconds, after which the LED is turned off and a neighboring LED is turned on

The direction of the moving light will be determined by the setting of the DIP switches. For SHIFT LEFT, the light will be moving from right to left starting with the LED connected to the pin PB0 of Port B and progressing to the LED connected to PB7. After reaching PB7, the process will be repeated again from PB0. For SHIFT RIGHT, the procedure will be similar, only the LED connected to PB7 will lighten up first and the light will progress to the right towards PB0, and then continue again from PB7.

For the ALL configuration, all diodes will be flashing synchronously with the on/off period being approximately 0.5 seconds.

To aid in implementation: Use hcs12.inc file if it is needed for commonly referenced locations of HCS12DP256. Use the hcs12.inc file using the #include directive at the beginning of your program.

Set up the ports needed for reading the DIP switchesand driving the LED's

Initialize the interrupt vector for RTI

Configure the RTI period. Note that for longer required periods, it may take more than one RTI to trigger one change of the LED pattern

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!