This document provides an overview of a workshop on basic robotics and embedded systems simulation. It discusses microcontrollers and some popular models like the AVR ATmega16. It describes the ATmega16's features like memory, I/O ports, timers and interfaces. It also explains concepts like I/O registers, binary-hexadecimal conversion, and using embedded C to code for the microcontroller. Examples provided include blinking an LED, pulse width modulation for LED contrast control, and motor speed control.
3. Microcontrollers
abbreviated µC, uC or MCU
single integrated circuit
◦ processor core
◦ memory
◦ programmable input/output peripherals.
A computer system optimized for
hardware control in a single piece of
silicon..
8. Extra Information:
• General purpose register :
Stores local variables
I/O registers:
Configures the I/O peripherals
FLASH:
Stores our program code and bootloader
Starts with memory address 0x00
EEPROM:
It can be used to store those values to be stored
even when switched off
Slow to access
9. I/O ports
• 4 i/o ports namely PORT A, PORT B,
PORT C and PORT D
• PORT A has ADC
• Any PIN can be configured both for
input or output.
• BUT how to configure??
10. AVR REGISTERS
Stores some important values
Windows registry..?
Contains address of pins in
hexadecimal values
Stores the configuration settings
11. Registers
Data Direction Register(DDR)
◦ 0 means INPUT PIN
◦ 1 means OUTPUT PIN
PORT Register
◦ Configures output
0 means 0v
1 means 5v
PIN register
◦ Stores the input at any PIN
1if input is a 5v signal
0 if input is 0v
12. Binary to HexaDecimal
Conversion
Easy to express.
Binary contains 0 and 1
Hexadecimal s/m contain 0 to 9 and A
to F
Binary to hex
Hex to binary
13. Use of TTL logic.?
What is TTL logic
0’s and 1’s what is its meaning??
0GND….but what is GND
1VCC…what is VCC
14. DDR
DDRx where x=A,B,C,D
8-BIT binary/hexadecimal value
Example:
◦ DDRA=0B01110101;
18. PIN
Stores the input that the
microcontroller detects…
Example of input s/m
8-bit binary/hexadecimal value
Example:
◦ If PINA==0b00101111do something
20. Embedded C
• Most powerful programming Language
• Fast execution
• Reduced Instructions
• Similar to simple C coding
21. Essential Software and
Hardware
Softwares:(will be provided: open source)
◦ Winavr
◦ HIDbootFlash
◦ Proteus ISIS
Hardwares:(will be provided)
◦ RigDev Board
Low cost than corporate development boards
Based on Atmega 16
In built USB interfacing
22. Getting Started
Install Winavr
Install HIDbootFlash
Check the RigDev Board
◦ Programmers notepad
◦ mfile
23. General Structure of a code
#include<avr/io.h>
int main()
{
}
This is the general format of any embedded C code that we write
for ATmega uCs.
#include<avr/io.h> includes the details about the PIN
configurations of ATmega series of uCs.
Our code is written inside the main() function.
28. More about it
Made up mostly using GaAs.
Light emitted due to electrical
excitation
How to identify cathode
◦ Leg method
◦ Edge method
NEVER CONNECT LED DIRECTLY
TO SUPPLY
Resistor in series.
33. LED Contrast Control
#include “pwm.h” includes the header
file for speed control
pwminit(int freq) initializes pwm at
required frequency
pwm(int a,int b) sets pwm on PD4 and
PD5
a and b are duty cycles
a controls PD4 and b controls PD5
36. Motor Speed Control
#include “pwm.h” includes the header
file for speed control
pwminit(int freq) initializes pwm at
required frequency
pwm(int a,int b) sets pwm on PD4 and
PD5
a and b are duty cycles
a controls PD4 and b controls PD5