Introduction To Embedded C++ Programming

From QC Co-Lab
Jump to navigation Jump to search

This page describes a class proposal David Hinkle is developing for qccolab. All information in this is provisional. To comment on this proposal, please use the mailing list. Please do not edit the draft directly right now because I would like to keep track of what's going into it. (Unless you want to fix my terrible spelling or grammer, feel free to correct those areas).

The purpose of this class will be to demonstrate C++ programming and digital electronics techniques for people that have never done any programming.

Microcontroller Resources

Spin Chip

Very unusual architecture. Two C compilers available, but one of them is commercial. The open source one looks serviceable

PIC Chip

Many C compilers for this one, this is the "official" compiler.

Arduino

Native in C++, standard development tools are actually C++ with some extensions.

Full List of Materials

  • PIC Micro-controller
  • bread board or proto-board
  • Assorted LED's
  • Potentiometer
  • Assorted Batteries
  • A computer to do development on for each student (Some combination of bring your own laptop plus club workstations if we can scare any up)
  • Pic programmer
  • Switch
  • A motor that supports control via PWM

Costs

Shooting for a cost of $20 if we provide materials. Debate over additional surcharges continues and issue hasn't been settled yet. Also we have not determined if we will be buying materials or just providing a material list.

Syllabus

Day 1 - Hello World

Materials

  • PIC Micro-controller
  • bread board or proto-board
  • Assorted LED's
  • Assorted Batteries
  • A computer to do development on for each student
  • Pic programmer
  • Switch

Syllabus

Hello World in C++ using digital outs

Develop a simple circuit with a power source, micro-controller, leds and batteries that flashes "Hello World" in Morse Code.

  • Get development tools installed
  • Demonstrate software compiling with simplest possible program that can be compiled
  • Teach how to make decisions in C using if statements and various loop constructs
  • Compile Morse Code program and burn program to PIC


Day 2 - Analog and Digital Input

Materials

  • PIC Micro-controller
  • bread board or proto-board
  • Assorted LED's
  • Assorted Batteries
  • A computer to do development on for each student
  • Pic programmer
  • Switch
  • Potentiometer

Syllabus

Develop a simple circuit that allows a pot to control the brightness of a LED by controlling the rate at which it is turned on and off, and a switch to signal the microcontroller to switch from a brightness mode back to our morse code mode. This class demonstrates analog to digital conversion and digital input.

  • Teach about how to read from the DAC
  • Basic object and function calls

Day 3 - Motor Control using Pulse Width Modulation

Materials

  • PIC Micro-controller
  • bread board or proto-board
  • Assorted LED's
  • Assorted Batteries
  • A computer to do development on for each student
  • Pic programmer
  • Motor that supports PWM control

Syllabus

Develop a simple circuit that allows a user to control the speed of a motor using PWM.

  • More advanced objects to abstract devices

Day 4 - Arduino and How it's Different

Materials

  • Arduino
  • bread board or proto-board
  • Assorted LED's
  • Assorted Batteries
  • A computer to do development on for each student
  • Motor that supports PWM control

Syllabus

Demonstrate how origional classes would have been programmed differently on the arduino.

  • Get arduino development tools installed
  • Demonstrate software compiling with simplest possible program that can be compiled
  • Morse code and dimming circuit on the arduino
  • Motor control with the arduino

Day 5 - The internet

Materials

  • Arduino
  • Arduino Ethernet Shield
  • bread board or proto-board
  • Assorted LED's
  • Assorted Batteries
  • A computer to do development on for each student
  • Motor that supports PWM control

Syllabus

Talk about the internet, how it works at a very basic level. Develop a circuit that can submit a tweet.

  • Explain IP addresses and domain names
  • Explain port numbers
  • Explain html forms and http post
  • Demonstrate how to post data to a website using an arduino