Wenton Davis' EE312 Page
The 68HC11 is one of the oldest, most popular microcontrollers produced by Motorola. CTU uses the FOX11 board in the EE312 class, which is a very widely supported platform. But, when students want to search for support or information on the FOX 11, make sure that you include the word "Motorola" or "68HC11" as part of your search, or you'll quickly learn how many cities have the FOX network on channel 11!
A number of years ago, Freescale (at the time, was still named Motorola) discontinued the 68HC11 Family. This means that the nearest chip to the 68HC11 is the 68HC12. This is what provides the "12" on the "Dragon-12" boards we will use for this class.
There is a very important document, the reference manual for the 68HC11, that is here. The reference manual for the MC9S12DG256 <> and the datasheet is here or here. And finally, the instruction set manual is found here.
Some dragon-12 specific files:
user manual for REV E and REV F.
Support software, AsmIDE, AS12: dragon12_plus2.zip. This could be unzipped and stored in a folder. "C:\Dragon12Plus2" would be a good choice. A good idea (although not necessary) would be to add your new directory to the system $PATH variable. Visit this for instructions on how to do this.
Dragon12 Schematic Diagram: dragon12_plus2_011714
Much more complete datasheet for HC12: MC9S12C128V1.pdf
A "header" file you will need is reg9s12.h. You can include this in the directory you just saved all of the support software in. You should always copy this into the same directory as your project, and you can include it by writing the command
INCLUDE reg9s12.hOr you could alternatively choose to only use the one in C:\Dragon12Plus2 with the command
The D-Bug12 reference guide is here.
Using and extending D-Bug12 Application Note is here. BUT you are taking your life (well, your board's life) into your own hands with some of this. NEVER modify the flash or EEPROM without being sure about what you are doing. There is some really cool stuff available in here, but ther is "enough to be dangerous."
For the really brave, there is the Gnu "as" can be used. There is a useful document here.
LCD module (WLD version):
The new reg9s12.h. This file has been modified so that if it get included more than once, it no longer presents errors.
The new LCD.asm. This file should be included anywhere within the executable code. (e.g. anywhere after the ORG $2000 command.)
testnew.asm is a file to demonstrate the new version of the LCD module.
BE CAREFUL!!!!! If your computer does not have an RS232C port (COM1, COM2, etc.) because most manufacturers have STUPIDLY abandoned the RS232 in favor of USB, you will need to buy an USB-to-RS232 converter. There are two different versions of this critter, though, and one of them is totally useless. The version that is useless does not manage the baud-rate timing; it just dumps data out at the same rate as the USB port, with is not going to work. The type you want will have either a box in the middle of the cable, or have a clunky-looking end for the serial port end. These types of converters actually have small microcontrollers in them to handle the conversions. As a rule of thumb, if you find a converter for less than about $9, leave it on the shelf, but if you find one around $14 or more, that's the one you want.
Uhm.... well.... from this point on, take things with a grain of salt. The course is being re-written, and although everything above this point is valid, everything below here may be changed. The labs have all changed, and that section is in desperate need for being re-written. the Programming Requirements section is about the same, just a few little touch-up things to do; same with the Programming Hints section.
One thing that is very important in programming is the need for documentation, usually in the form of comments included in the source code. This is particularly important in assembly language because assembly language is more difficult to read than high-level languages are. LDAA #$3B is not very meaningful, and needs to have at least some short description, what special meaning does the number #$3B have, and why is it being loaded into accumulator A? In this class, EVERY line of code is expected to have a comment.
Each subroutine also has some comments that are expected
to be found. This comment should include at least the following:
;****************************************** ; pr_buf subroutine - Print N hex bytes with each followed by a space ; Entry: A = the number of bytes to be printed ; X = the address of the first byte to print ; Exit: Nothing ; Registers modified: None ;******************************************
Example 2: (This came from a subroutine that could be called from a 'C' program.)
;=========================================================================== ; detexp16 - unsigned int detexp16( short ) - detect shift exponent | ;--------------------------------------------------------------------------| ;Input: %EAX is a short (16-bit) value to detect the exponent | ;Process: validate input. Shift to left-justify the bits. Look at the | ; top two bits to see if they are different. If so, get ready to | ; return. If not, shift them left one bit, decrement the counter, | ; and re-examine the bits. | ;Output: %EAX carries output exponent. If this is called via assembly | ; code, the adjusted value can be found in %EBX. | ;===========================================================================
A common problem using the Ep2ide seems to be that saving the file does not default to using the ".asm" extension on the end of the file name. As a result, assembling the program fails because the assembler does assume the ".asm" and the IDE responds with the message, "Unable to find file." To fix this, always make sure you include the ".asm" at the end of your file name. Also notice that once the IDE recognizes your file as an assembly language source file, it colorizes the text; reserved words are dark blue and variable names are burgandy.
Another common problem is the disk images the school uses to reload the machines every night. For some reason, the CTU disk image for the computers in lab 134 do not use the correct path to the AS11.EXE program (the assembler). The fix for this is a bit annoying because you would have to repeat it every day: from the view menu, then options, select the Assembler tab. The top text field is used to find the assembler, and should be set (use the button with three dots) to:
On this same screen, the bottom text field is the command line sent to the assembler. It should look like this:
% -o@.s19 -L@.lst -s@.sym
Flowcharting is an absolute MUST!
GCC for Windoze Found at armDeveloper
If you need to reach me, you can always email me at email (firstname.lastname@example.org)