EMBEDDED C USING CODEWARRIOR Getting Started Manual



Similar documents
CodeWarrior Development Studio for Freescale S12(X) Microcontrollers Quick Start

Hitchhiker's Guide to CodeWarrior EE371, EE475 Fall 2005

IGSS. Interactive Graphical SCADA System. Quick Start Guide

Freescale Semiconductor, I

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

ROBOTC Software Inspection Guide with Additional Help Documentation

USBSPYDER08 Discovery Kit for Freescale MC9RS08KA, MC9S08QD and MC9S08QG Microcontrollers User s Manual

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

DIRECT INTERNET DATA. User s Guide

Getting Started with the Student Learning Kit Featuring the Freescale HCS12 Microcontroller Application Module

Table of Contents. 1. Overview Materials Required System Requirements User Mode Installation Instructions..

SoundLAB Software Download Software from the Bogen website:

Plena Voice Alarm System Firmware update

Using the VEX Cortex with ROBOTC

Windows XP.. ELITE Firmware Update procedures.. v1.41

EasyC. Programming Tips

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

XConsole GUI setup communication manual September 2010.

Bluetooth Installation

Modern Robotics, Inc Core Device Discovery Utility. Modern Robotics Inc, 2015

Using the HCS12 Serial Monitor on Wytec Dragon-12 boards. Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards

Work with Arduino Hardware

USER GUIDE. Ethernet Configuration Guide (Lantronix) P/N: Rev 6

User s Manual for Fingerprint Door Control Software

USB Driver Installation for Windows XP

Driver Updater Manual

Guide to Installing BBL Crystal MIND on Windows 7

Pocket Verifier Quick Start HTC Touch Diamond

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

QUICK START GUIDE. SG2 Client - Programming Software SG2 Series Programmable Logic Relay

Board also Supports MicroBridge

SA-9600 Surface Area Software Manual

Business Plus Accounting Hardware Setup Guide For Windows XP

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

3. USB DRIVER Installation of USB driver Driver for Infinity SD Data Logger. INFINITY Series Acquisition Tools Manual

Quick Start Guide. TWR-MECH Mechatronics Board TOWER SYSTEM

Exchange Outlook Profile/POP/IMAP/SMTP Setup Guide

ROYAL REGISTERLINK USER'S GUIDE

Fujitsu SCSI Scanner Installation Procedures Windows 95\98\98SE\ME\2000\XP\Vista

DUKANE Intelligent Assembly Solutions

Installing S500 Power Monitor Software and LabVIEW Run-time Engine

TE100-P21/TEW-P21G Windows 7 Installation Instruction

isppac-powr1220at8 I 2 C Hardware Verification Utility User s Guide

Installing the Gerber P2C Plotter USB Driver

Initial Setup of Mozilla Thunderbird with IMAP for Windows 7

SMS Database System Quick Start. [Version 1.0.3]

User Manual. Thermo Scientific Orion

The service note describes the basic steps to install a ip camera for the DVR670

Neoteris IVE Integration Guide

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide

MT-350 SMS. Operation Manual. PORTech Communications Inc.

Introduction. POP and IMAP Servers. MAC1028 June 2007

Mini Amazing Box Update for Windows XP with Microsoft Service Pack 2

Setting up VMware ESXi for 2X VirtualDesktopServer Manual

DRV8312-C2-KIT How to Run Guide

SATA+Ultra ATA RAID CONTROLLER RC212. User Manual

Creating Forms With Adobe LiveCycle Designer 8.2

IXP120 Alarm Monitor Utility

MFC7840W Windows Network Connection Repair Instructions

Quick Installation Guide Network Management Card

BillQuick Agent 2010 Getting Started Guide

Exchange Outlook Profile/POP/IMAP/SMTP Setup Guide

P&E Microcomputer Systems, Inc. P.O. Box 2044, Woburn, MA 01888, USA

SOFTWARE GUIDE PM1405 DATA PROCESSING SOFTWARE

Creating a Project with PSoC Designer


Connecting the DG-102S VoIP Gateway to your network

This document is intended to make you familiar with the ServersCheck Monitoring Appliance

KI6501 Data Manager. Software User Manual

mypro Installation and Handling Manual Version: 7

Lab 1: Introduction to Xilinx ISE Tutorial

Hypercom Key Loading and Management (HKLM) RS232 PPP Key Injection PC Setup Guide

Company Setup 401k Tab

Downloading Driver Files

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

TR-3 Channel Editor. Software Manual

SMS Alarm Messenger. Setup Software Guide. SMSPro_Setup. Revision [Version 2.2]

Stellar Phoenix. Access Database Repair 5.0 Installation Guide

Installing Your POS Hardware

Centurion PLUS CPC4 Download Guide

SCOoffice Mail Connector For Microsoft Outlook. Installation Guide Outlook 2002

Testing Robots Using the VEXnet Upgrade

Assignment 09. Problem statement : Write a Embedded C program to switch-on/switch-off LED.

DIAL-UP DATA. User s Guide

EPIC 950 THERMAL TICKET PRINTER

Windows Mail POP Instructions - Bloomsburg University Students

Starting Guide - Poseidon 3265 First steps for remote monitoring with Poseidon & GSM

Back-up Server DOC-OEMSPP-S/2014-BUS-EN-10/12/13

Cart Interface Installation & Control Board Manual for M38 XP and RX Carts and Legacy M39 Carts

Sales Person Commission

Shearwater Research Dive Computer Software Manual

Contents. Hardware Configuration Uninstalling Shortcuts Black...29

Iridium Extreme TM Satellite Phone. Data Services Manual

Global Water Instrumentation, Inc.

USB VoIP Phone Adapter. User s Manual

Virtual Office Remote Installation Guide

How to Setup and Connect to an FTP Server Using FileZilla. Part I: Setting up the server

Raptor K30 Gaming Software

Maxtor OneTouch User's Guide

Transcription:

Embedded C using CodeWarrior 1 68HC12 FAMILY EMBEDDED C USING CODEWARRIOR Getting Started Manual TECHNOLOGICAL ARTS, INC. Toll-free: 1-877-963-8996 (USA and Canada) Phone: +(416) 963-8996 Fax: +(416) 963-9179

Embedded C using CodeWarrior 2 WHY AM I READING THIS MANUAL? If you have purchased an HC12 module, with a docking module, from Technological Arts and are wondering what to do next, you are at the right place! Or, if you have been accustomed to programming in assembly for most of your career and you want to get your feet wet in embedded C, using CodeWarrior 3.0, then this manual should give you a good start. Before you dive in and start creating robots or an alarm system to alert you about visiting in-laws, you will need an overview of the CodeWarrior 3.0 environment to get you started. This graphic oriented step-by-step guide will show you how to: Create a project Write a simple source code, using embedded C Make file Download the code to your HC12 module Pat yourself on the back when you have completed this task and then gloat to your friends about how you spent $130 to press buttons and see lights turn on. You can program the HC12 to do a lot more once you have become familiarized with programming some of the many features of the HC12 including: Timer functions to measure frequencies or generate pulses to vary motor speed among other things Analog to Digital Conversion for extracting data from the outside world The SCI and SPI for communicating with asynchronous and synchronous peripherals respectively (keyboards, mice, monitors etc.) Parallel ports to interface to a variety of devices including LCD and seven segment displays Combining some or all of these features together to create some incredible projects NOTE: Programming of the HC12 s features is beyond the scope of this manual. These topics will appear in future manuals from Technological Arts. Getting started is as simple as it sounds. SO LETS GET STARTED!

Embedded C using CodeWarrior 3 GETTING STARTED We have assumed that you have already installed Metrowerks CodeWarrior 3.0 on your PC. If not, there is a guide included in your HC12 kit that shows you how to install CodeWarrior and how to obtain a license. STEP 1 CREATING YOUR FIRST PROJECT a. If code Warrior is not already open, you can start the application by selecting: Start>Programs>Metrowerks CodeWarrior>CW12 3.0> CodeWarrior IDE b. Figure 1-The Metrowerks CodeWarrior window will pop up: Figure 1 c. From the Menu bar, select File > New

Embedded C using CodeWarrior 4 d. Figure 2 - The New dialog box will popup. Under the Project tab: Select HC(S)12 New Project Wizard Type example in the Project name textbox (However, the Project Name can be any name you want) Specify the location where you want to save the project Click OK Figure 2 e. Figure 3- Select the HC12 derivative that you will be programming. In this case we have selected the MC9S12C32. WARNING: Selecting the wrong derivative will cause problems when you program your board! Click Next Figure 3

Embedded C using CodeWarrior 5 f. Figure 4-Check off C and click Next Figure 4 g. Figure 5- Select No for processor expert Figure 5

Embedded C using CodeWarrior 6 h. Figure 6-Select No for PC-lnt Figure 6 i. Figure 7- Select None for float point format Figure 7 Almost there!!!!

Embedded C using CodeWarrior 7 k. Figure 8- Select Small for memory model Figure 8 l. Figure 9- Uncheck Metrowerks Full Chip Simulator Check Motorola Serial Monitor Hardware Debugging Click Finish Get ready to code! Figure 9

Embedded C using CodeWarrior 8 STEP 2 - LETS WRITE SOME SOURCE CODE Figure 10-This is your new project window. Expand the Sources folder by clicking on the [+] and double click on main.c Figure 10 Figure 11-The source code window called main.c should popup. This is where you write the source code (the embedded C code) for your project Figure 11

Embedded C using CodeWarrior 9 Table 1-Delete the contents of the main.c window and copy and paste the following code into the source code window (main.c). Select File>save. #include <hidef.h> /* common defines and macros */ #include <mc9s12c32.h> /* derivative information */ #pragma CODE_SEG DEFAULT void main(void) { DDRT = 0x03; ATDCTL23 = 0x0; ATDCTL45 = 0x0; ATDDIEN = 0xFF; } while(1) { PTT = ~(PTAD/64); } Table 1 STEP 3 - COMPILING YOUR CODE From the menu bar select: File > Project > Make Optionally you could just press function F7 on your keyboard Figure 12-This step will compile your code and display any errors in or warnings in the Errors & Warnings window as shown. For now ignore the warnings. If you have any errors, double check the code to make sure you have copied and pasted everything correctly Figure 12

Embedded C using CodeWarrior 10 STEP 4 - PROGRAMMING THE HC12 BOARD Congratulations on making it this far! We are now on the last few stages. PART 4a - Connecting your HC12 module With your HC12 module out of the box connect the 9V power supply which is included with your kit. Connect the serial cable, included with your kit, between the serial port of your PC and the female serial connector of the HC12 module Make sure that switch SW1 on the module is in BOOT mode Plug in the power supply PART 4b - Downloading your Assembled program Figure 12-On the new.mcp tab click on the debug button Figure 13

Embedded C using CodeWarrior 11 Figure 14 - The Monitor Setup dialog box will pop up. Select the COM port that your HC12 module is connected to (eg. COM1, COM2, etc). Click OK Figure 14 Figure 15- The True Time Simulator and Real-Time Debugger window will appear Figure 15

Embedded C using CodeWarrior 12 Figure 16 - In the Command Window at the bottom right of the True Time Simulator and Real-Time Debugger, figure 16, type GO as shown and hit enter. Figure 16 Switch SW1 on the HC12 module into RUN mode and press reset. This should start the program The program should now be running. Pressing the user buttons SW2 and SW3, on the docking module, should turn on LEDS D2 and D3 respectively. CONGRATULATIONS you have now completed your first embedded C program using CodeWarrior CONCLUSION You have now learned how to create project, where to write the source code, how to compile the source code and, finally, download the project to your HC12 module. This just a tip of the iceberg. The next step is to understand the concepts behind some of the various registers and functions that the HC12 offers, and how to program these devices and other peripherals commonly attached to the HC12. Of course, knowledge of the C language is important for embedded C programming. If you are looking for a good crash course on ANSI C programming we highly recommend the book: The C Programming Language Second Edition. Brian W. Kernighan, Dennis M. Ritchie. Prentice Hall Software Series. Also keep checking back on the Technological Arts website @ as we will be posting how to guides on how to interface with the commonly used features of the HC12.