170 likes | 313 Views
The miniDragon+ Board and CodeWarrior. Lecture L2.1. 2 pushbutton switches. Serial cable. A/D Pot. Run/Load switch. Reset button. 7-segment display. Power plug. I/O headers. miniDragon+. Table 1.1 Parallel Ports in the MC9SDP256. Registers associated with parallel I/O ports.
E N D
The miniDragon+ Boardand CodeWarrior Lecture L2.1
2 pushbutton switches Serial cable A/D Pot Run/Load switch Reset button 7-segment display Power plug I/O headers miniDragon+
Registers associated with parallel I/O ports Port Data Register Port Data Direction Register DDx[7:0]: Data Direction for Port x 0 – Input 1 – Output
A 7-segment display contains seven light emitting diodes (LEDs)
The miniDragon+ board has a common-cathode 7-segment display. This means that all the cathodes are tied together and connected to ground. The output pins 6:0 of Port H are connected through a 1 kW current-limiting resistor to each of the anodes, g – a. In the common-cathode case, an output 1 will turn on a segment and an output 0 will turn it off. Port H: bit 6 5 4 3 2 1 0 g f e d c b a
LBE_DP256 is a stationery project that we have created that contains the file main.asm which includes over 80 assembly language routines to perform many I/O functions for the MC9S12DP256 microcontroller on the miniDragon+ board.
Example 1a is the default main.c program for a LBE_DP256 project.
Example 1a // Example 1a: Turn on every other segment on 7-seg display #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void main(void) { PLL_init(); // set system clock frequency to 24 MHz DDRH = 0xff; // Port H is output PTH = 0x55; // switch on every other segment for(;;) {} /* wait forever */ }
Lab 1 Go through the CodeWarrior tutorial in Appendix A. In this tutorial you will compile and run the C programs for Examples 1 – 4.