Hands-On Technical Training (hott) Workshop: Introduction to Microcontroller Programming in C



Download 110.29 Kb.
Page1/5
Date29.01.2017
Size110.29 Kb.
#11287
  1   2   3   4   5

Student name:_______________________

Hands-On Technical Training (HOTT) Workshop:
Introduction to Microcontroller Programming in C


Rev. 10JULY2008


Table of Contents





Hands-On Technical Training (HOTT) Workshop:
Introduction to Microcontroller Programming in C 1

Table of Contents 1

How to Use this Training Material if provided on CD or in Zipped File: 3

Workshop objectives: 3

What is an Embedded Controller? 4

What is a Microcontroller? 4

Microcontroller Advantages 4

Microcontroller Disadvantages 4

Microcontroller Architecture Example 5

Microcontroller Selection Considerations 5

Lab Setup for this Workshop 7

Programming Language Considerations 7

A Brief Introduction to the C Programming Language 8

Data Types 8

Declaring Variables and Assigning an Initial Value 8

Comparison 10

Logical Connectors 11

The if else Statement 11

Loops 12

The for Loop 13

Functions in C 13

Freescale IDE Software Installation 16

Hardware Familiarization and Connection to PC 16

Understanding the RS08 I/O 17

Launching & Exploring the IDE 19

Creating a new project 19

Configuring the Microcontroller Chip for Proper Operation with the Development Board 23

Editing and Downloading a Program 25

Modifying the Program to Slow Down the LED1 Blink Rate 28

Debug Tools: Monitoring, I/O, Breakpoints, and Other Neat Stuff 30

Monitoring the Program & I/O 30

Using Breakpoints 31

Stand-alone uC Circuit Example:
Minimum Circuit Required for the Hello World Example Program 32

Links to Executable Programming Examples Provided with this Training Material (CD or unzipped directory) 33

Additional Resources 35

Documents Provided with this Training Material (CD or unzipped directory) 35

Online Resources 35

Support 35

Purchasing Your Own Demo Kits and Microcontrollers 35



How to Use this Training Material if provided on CD or in Zipped File:


  1. Unzip if necessary and copy entire root directory of all files to your PC hard drive.

  2. Open this document file in your web browser. There are hyperlinks located throughout that will enrich your user experience.

Workshop objectives:


  1. Learn what a microcontroller is and some typical applications.

  2. Learn some criteria to consider when selecting a microcontroller.

  3. Learn fundamental microcontroller programming in the C language.

  4. Learn how to use a typical C Compiler and IDE (Integrated Development Environment) for developing microcontroller applications.

  5. Learn the basics of C programming by editing various C programs and testing them on an actual Freescale RS08 microcontroller.





Prerequisites: None, but some programming experience is helpful, especially C, C++, or C#.

What is an Embedded Controller?

As stated at http://www.esacademy.com/automation/faq/primer/2.htm:




An embedded controller is basically a controller (typically a microcontroller, microprocessor, or computer) that is embedded into some [system or] device for some purpose other than to provide general purpose computing.



This device would be called an Embedded Control System. Some examples might be a home appliance or toy with a microcontroller inside of it or a factory automation system that contains a dedicated computer control box.

What is a Microcontroller?


According to wikipedia:

A microcontroller (also MCU or µC) is a computer-on-a-chip. It is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC). In addition to all arithmetic and logic elements of a general purpose microprocessor, the microcontroller usually also integrates additional elements such as read-only and read-write memory, and input/output interfaces.

Microcontroller Advantages


  • Highly integrated and powerful – thousands of transistors on a single chip.

  • Can be used to replace a handful of discrete logic chips.

  • Relatively easy to learn and implement.

  • Easier to integrate into a design than discrete logic chips.

  • Very low hardware cost possible (the RS08KA2 microcontroller chip used in this lab costs less than $0.50 each in large quantities!).

  • Many types and manufacturers available.

  • Architectures and programming languages vary somewhat, but not completely, so what you learn about one microcontroller (uC) is good knowledge to apply to another one.

  • Many different IC packages available (DIP8, SOIC-16, etc.)


Microcontroller Disadvantages


  • Microcontrollers are IC chips and need to be put onto a custom-designed PC board. This takes time and money, which may not suit all applications. Contrast this with an industrial automation PLC, which is a computer-in-a-box that contains simple screw terminals to connect power, communication, and I/O.

  • Programming microcontrollers requires a certain amount of skill and training.

  • The programming and debugging software can be quite costly.


Microcontroller Architecture Example


An example of a simple microcontroller is shown here embedded in a system:


Embedded Control System



Freescale RS08KA2 Microcontroller Chip

Memory Areas



Timers

& Counters






Core Microprocessor



Interrupt Control Subsystem

Analog Comparator




Input/Output (I/O) Section




To other electronic devices (pushbuttons, LEDs, speakers, etc.)





Directory: people
people -> Math 4630/5630 Homework 4 Solutions Problem Solving ip
people -> Handling Indivisibilities
people -> San José State University Social Science/Psychology Psych 175, Management Psychology, Section 1, Spring 2014
people -> YiChang Shih
people -> Marios S. Pattichis image and video Processing and Communication Lab (ivpcl)
people -> Peoples Voice Café History
people -> Sa michelson, 2011: Impact of Sea-Spray on the Atmospheric Surface Layer. Bound. Layer Meteor., 140 ( 3 ), 361-381, doi: 10. 1007/s10546-011-9617-1, issn: Jun-14, ids: 807TW, sep 2011 Bao, jw, cw fairall, sa michelson
people -> Curriculum vitae sara a. Michelson
people -> Curriculum document state board of education howard n. Lee, C
people -> A hurricane track density function and empirical orthogonal function approach to predicting seasonal hurricane activity in the Atlantic Basin Elinor Keith April 17, 2007 Abstract

Download 110.29 Kb.

Share with your friends:
  1   2   3   4   5




The database is protected by copyright ©ininet.org 2024
send message

    Main page