Please do problem number 1,2,3 and 6 Consult the Dragon 12 plus board manual, an
ID: 3688317 • Letter: P
Question
Please do problem number 1,2,3 and 6 Consult the Dragon 12 plus board manual, analyze it thoroughly and make a summary of which peripheral is connected to which pin in the microcontroller Explain the difference between the several ways a subroutine can be called, and how to return from them How can you program an IO pin on the HCS12. How do set its direction, and what are the instructions to read or write a whole port or individual pins of a port? Assuming that we have the following instruction sequence to be executed by the HCS12 what will be the contents of the topmost 4 bytes of the stack after the execution of theses instructions? Write the instructions to perform the following operation: Push the value $2301 (word value)onto the stack push the value $34 (byte value) onto the stack pop the top word of the stack and save it at memory location $1000 - $1001 push the 15-bit value store ate $ 1000 - $ 1001 into the stack Make a summery of all the address modes of the HCS12, with example of instructions using it, and the explanation of each one.Explanation / Answer
2.
In computer programming, a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Subprograms may be defined within programs, or separately in libraries that can be used by multiple programs. In different programming languages, a subroutine may be called a procedure, a function, a routine, a method, or a subprogram. The generic term callable unit is sometimes used.
As the name subprogram suggests, a subroutine behaves in much the same way as a computer program that is used as one step in a larger program or another subprogram. A subroutine is often coded so that it can be started (called) several times and from several places during one execution of the program, including from other subroutines, and then branch back (return) to the next instruction after the call once the subroutine's task is done.
subroutine is the bridge between a function and a procedure. Every subroutine should contain a set of instructions to evaluate the functions and must contain a return statement at the end. This is how it differs from a pure procedure and acts like a function. The subroutine should also include instructions for accessing the function arguments and returning the result. These necessities are usually hidden in a high level language -- the compiler will generate the instructions for passing and returning values transparently. But the assembly/machine code for the function will inevitably contain these details. To return to our earlier function example, this could be the subroutine to evaluate F (written in pseudo-MIPS assembly):
1.Dragon contrller:
The Dragon12-Plus-USB trainer kit comes with the following items:
1. Dragon12-Plus-USB board
2. Software downloadable from our web site:
a. AsmIDE with HCS12 assembler
b. Sample programs with source code
c. Freescale application notes for the HCS12
d. Data sheets for on-board hardware
e. User’s manual
f. Reference documents
.
The default jumper settings before turning on the board:
1. The J1 should have a jumper for LCD backlight.
2. The J24 should have a jumper installed, but J18 should not have a jumper if there is no
motor connected to the terminal block T4. The jumper on J18 will turn on the H-Bridge U12.
If you see a jumper on J18, move it to J24 to reduce power consumption.
3. The J26 should have a jumper installed in the “TOP” position, so the speaker will be driven
by PT5. The speaker can be driven by timer (PT5) or PWM (PP5) or DAC. It defaults for
PT5. Without a jumper installed on J26 the speaker won’t sound.
4. The J41 should have a jumper installed in the “LOW” position, so the SCI0 receives signal
from USB port.
5. The J42 should have two jumpers installed vertically in the “UP” positions, so the USB
interface is connected to SCI0. If these two jumpers are installed in the “LOW” positions and
the jumper on J23 in the “TOP” position labeled with “USB” then the USB interface is
connected to SCI1.
6. The J32 should have a jumper installed, so the RGB color LED is enabled. The RGB LED is
driven by PP4, PP5 and PP6.
I/O Pin Usage
Many I/O pins of the MC9S12DG256 on the Dragon12-Plus-USB board are used by on-board
peripherals and it seems that there are only a few of unused pins left for your circuits on the
breadboard. Fortunately, it’s unlikely that all on-board peripherals will be used by one application
program. So the I/O pins on unused peripheral devices can still be used by your circuits on the
breadboard. For instance, if you don’t touch the 4x4 on-board keypad, the entire port A will be
available to your circuits. If you don’t use the LCD or just unplug the LCD, the port K will be
available as well. Port B drives LEDs, but if you ignore the status of the LED, the port B can drive
any other I/O devices on the breadboard. Each pin in port H reads a switch, but it still can be
used as an input for reading a TTL or CMOS output from your circuits.
Pin Name Pin # I/O Usage
PA0 (output) Pin 57 Col_0 of keypad
PA1 (output) Pin 58 Col_1 of keypad
PA2 (output) Pin 59 Col_2 of keypad
PA3 (output) Pin 60 Col_3 of keypad
PA4 (input) Pin 61 Row_0 of keypad
PA5 (input) Pin 62 Row_1 of keypad
PA6 (input) Pin 63 Row_2 of keypad
PA7 (input) Pin 64 Row_3 of keypad
PB0 (output) Pin 24 LED0 or H-bridge
PB1 (output) Pin 25 LED1 or H-bridge
PB2 (output) Pin 26 LED2 or H-bridge
PB3 (output) Pin 27 LED3 or H-bridge
PB4 (output) Pin 28 LED4
PB5 (output) Pin 29 LED5
PB6 (output) Pin 30 LED6
PB7 (output) Pin 31 LED7
PE0 (input) Pin 56 Abort switch SW8
PE1 Pin 55 not used
PE2 (output) Pin 54 Relay
PE3 (output) Pin 53 Opto-coupler
PE4 Pin 39 not used
PE5 Pin 38 not used
PE6 Pin 37 not used
PE7 Pin 36 not used
PH0 (input) Pin 52 DIP switch 1 or pushbutton switch SW5
PH1 (input) Pin 51 DIP switch 2 or pushbutton switch SW4 (input)
PH2 (input) Pin 50 DIP switch 3 or pushbutton switch SW3 (input)
PH3 (input) Pin 49 DIP switch 4 or pushbutton switch SW2 (input)
PH4 (input) Pin 35 DIP switch 5 (input)
PH5 (input) Pin 34 DIP switch 6 (input)
PH6 (input) Pin 33 DIP switch 7 (input)
PH7 (input) Pin 32 DIP switch 8 (input)
PJ0 (output) Pin 22 DIR of RS485
PJ1 (output) Pin 21 LED enable
PJ6 Pin 99 SDA for DS1307(U11) or external I2C (J2)
PJ7 Pin 98 SCL for DS1307(U11) or external I2C (J2)
PK0 (output) Pin 8 RS of LCD module
PK1 (output) Pin 7 EN of LCD module
PK2 Pin 6 DB4 of LCD module (bi-directional)
PK3 Pin 5 DB5 of LCD module (bi-directional)
PK4 Pin 20 DB6 of LCD module (bi-directional)
PK5 Pin 19 DB7 of LCD module (bi-directional)
PK7 (output) Pin 108 R/W of LCD module