Motorola CME-12B/BC, 68HC12BC32, 68HC12B32 manual Tutorial, Creating source code

Page 5

TUTORIAL

This section was written to help you get started developing software with the CME-12B/BC board. Be sure to read the rest of this manual as well as the documentation on the disk if you need further information.

The following sections take you through the complete development cycle of a simple "hello world" program, which sends the string "Hello World" to the serial port.

Creating source code

You can write source code for the CME-12B/BC board using any language that compiles to Motorola 68HC12 instructions. Included on the software disk is a free Assembler and also a freeware C compiler and Basic compiler.

You can write your source code using any ASCII text editor. You can use the free EDIT or NOTEPAD programs that come with your computer. A better code editor can be downloaded at: http://www.winedit.com. Once your source code is written and saved to a file, you can assemble or compile it to a Motorola S-Record (hex) format. This type of output file usually has a .MOT, .HEX or .S19 file extension and is in a format that can be read by the programming utilities to be programmed into the CME-12B/BC board.

It's important to understand your development board's use of Memory and Addressing when writing source code so you can locate your code at valid addresses. For example, when in debug mode, you should put your program CODE in External RAM. In assembly language, you do this with ORG statements in your source code. Any lines following an ORG statement will begin at that ORG location, which is the first number following the word ORG, for example: ORG $2000.

You must start your DATA (or variables) in a RAM location unused by your program, for example: ORG $1000. When finished debugging, you must change these ORG statements so that your program is moved to a valid EEPROM area - somewhere after hex 8000. Do this by putting an ORG $8000 in front of your Program CODE. Data may remain where it is or be moved down to internal RAM starting at ORG $800. You must also program the STACK register somewhere at the top of your available RAM, for example hex BFF. Do this with this instruction as the first instruction in your program code: LDS #$0BFF.

A look at the example programs on the disk can make all of this clearer. If you're using a compiler instead of an assembler, consult the compiler documentation for methods used to locate your code and data.

Source code created to run under the D-bug12 monitor environment will be slightly different than code written for stand-alone operation. The monitor contains interrupt and RESET vectors that your code must provide when it's no longer running under the monitor. See the Programming Flash EEPROM section for more information on this.

5

Image 5
Contents CME-12B/BC Contents Board Startup Installing the SoftwareGetting Started Software Development Support SoftwareCreating source code TutorialAS12 HELLO.ASM -LHELLO Assembling source codeRunning your application ORG $1000 to ORG $8000 Programming Flash EepromOFF Config SwitchMemory MAP MEM-SEL Jumpers Config SwitchLcdport Ports and ConnectorsKeypad GNDGND CAN-H CAN-L McuportCanport Busport COM1 Serial PortBDM-IN ResetEVU Compatibility Jumpers Bgnd GNDTroubleshooting Utilities Tips and SuggestionsLCD Character Codes LCD Command CodesTables Bulk Bug12 Monitor Commands

68HC12B32, CME-12B/BC, 68HC12BC32 specifications

The Motorola 68HC12BC32, CME-12B/BC, and 68HC12B32 are microcontroller units (MCUs) that are part of the renowned HC12 series, which gained popularity in embedded system designs due to their versatility, robust performance, and comprehensive feature set. These MCUs are widely used in automotive applications, industrial control systems, and various consumer electronics due to their advanced capabilities.

One of the main features of the 68HC12BC32 is its 16-bit architecture, which allows for efficient processing and greater precision in calculations compared to 8-bit counterparts. This feature is crucial for applications requiring high-performance processing, such as real-time control systems. The processor operates at clock speeds of up to 25 MHz, providing the computational power necessary for complex operations.

The 68HC12MCUs include various on-chip memory options, such as ROM, RAM, and EEPROM. For instance, the 68HC12BC32 comes with up to 32 KB of ROM and 1 KB of RAM, along with 512 bytes of EEPROM, making it suitable for applications that require data retention even when the power is turned off. The presence of on-chip memory significantly reduces the need for external components, simplifying system design and enhancing reliability.

Moreover, these microcontrollers feature a rich set of input/output (I/O) capabilities, including multiple general-purpose I/O lines, timer/counter modules, and analog-to-digital converters (ADCs). The integration of these components allows for flexible interfacing with a multitude of sensors and actuators, enabling designers to create sophisticated applications without needing extensive external circuitry.

The embedded communication interfaces, such as SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), and CAN (Controller Area Network), are vital for enabling communication between devices in multiprocessor systems. This capability is particularly beneficial in automotive applications, where seamless data exchange is critical for tasks such as engine control and diagnostics.

Power management features in the 68HC12 series enhance its suitability for battery-powered applications. The ability to enter low-power modes helps extend battery life, making these microcontrollers ideal for portable devices.

In summary, the Motorola 68HC12BC32, CME-12B/BC, and 68HC12B32 microcontrollers are robust and flexible MCUs that offer a combination of advanced processing capabilities, extensive memory options, versatile I/O functionality, and efficient communication interfaces. These characteristics make them well-suited for various applications, from automotive and industrial systems to consumer electronics, ensuring they remain relevant in the evolving landscape of embedded technology.