MSc Human and Biological Robotics (BHM1)
Embedded C for Microcontrollers
- To develop, from the basic knowledge of microcontrollers provided in ME2 Mechatronics, an ability to program, in C, mechatronic systems containing typical sensors and actuators.
ECTS units: 6
Contributing to Course Elements: 6 to ME3-LCTVS or ME4-LCTVS
On successfully completing this module, students will be able to:
- Recall the principal terminology of stored-program computer hardware and software
- Write simple C programs manipulating text, numerical bit-pattern data
- Design, make, test and document a functional mechatronic system containing an embedded microcontroller
- Assemble a working microcontroller-based mechatronic system on a prototype board
Introduction to C language: structure, types and variables, arrays, assignment operations, conditional expressions, flow control, switch.
Advanced C language: structures, functions, recursions, pointers.
Introduction to microcontrollers: architecture, PIC18FXXX examples, the PICKit Programming Device, programming, debugging.
Bit operations: inputs and outputs: digital IO, analog IO.
Application: time-based interrupts.
Time measurement: oscillators, timers; application to servo motors.
Further applications: recap of the material, LCD, ultrasonic distance measurement
Motor control: stepper motors, DC motors, PWM, optical encoders.
Communication (master): Serial Protocol Interface, SPI-master, I2C.
Communication (slave): SPI-slave, RS232 to PC.
In order to gain the maximum benefit from ECM, students are expected to have a good understanding of ME1 and ME2 mechatronics as well as ME1 computing, including:
- Use of oscilloscope
- Assembling simple circuits (breadboard)
- Standard programming structures: conditional statements (if… then… else), loops (e.g. for… next)
- Binary and hexadecimal number bases.
- Resistor network analysis
- Pulse width modulation
- Data acquisition
- Duration: Spring term (10 weeks)
- One 3-hour lab-based tutorial per week, supported by in-situ lectures.
- Non-assessed hands-on system construction and programming exercises supported by tutor feedback.
- Individual system construction and programming project chosen from a closed list.
Summary of student timetabled hours:
Expected private study time: 5hr per week on individual project.
Individual project: 200 marks.