Download presentation
Presentation is loading. Please wait.
1
EE 22442 - Embedded Systems Fall 2015
Chapter Eight: The human and physical interfaces EE Embedded Systems Fall 2015 Belal H. Sababha, Ph.D. Assistant Professor of Electrical & Computer Engineering Computer Engineering Department King Abdullah II Faculty of Engineering Princess Sumaya University for Technology Amman, 11941, Jordan Phone: ext. 222 Web:
2
Introduction In this chapter we will learn about:
Human interfacing needs and some simple means of meeting these. Some simple example sensors. Some ways of interfacing between sensor signals and the microcontroller. Some simple example actuators. Some ways of interfacing between the microcontroller and the actuator.
3
Human physical interfaces
4
Human physical interfaces 2
5
The keypad
6
Reading a Keypad
7
LED displays
8
Multiplexing of digits
10
//Live Demo: Display a counter from 0 to 9 on a Single 7 Segment incremented every 1 sec
unsigned char tick=0; unsigned char i; unsigned char mysevenseg[10]={0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; interrupt(){ // TMR0 overflow interrupt occurs every 32ms tick++; //increment tick evey 32ms if(tick==33){ // this condition is true every almost 1 second i++; // counter incremented every 1 second if(i==10) i=0; tick=0; } INTCON = INTCON & 0xFB; // clear the interrupt flag void main() { TRISD = 0x00; //PORTD connected to the 7 segment OPTION_REG = 0x07; // Osc clock/4, prescale of 256 TMR0 = 0; INTCON = 0xA0; // Global Interrupt Enable and Local Enable the TMR0 Overflow Interrupt while(1){ PORTD=mysevenseg[i];
11
unsigned char tick, i, qq, rr;
unsigned char sevenseg[10]={0xBF, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x67}; interrupt(){ //TMR0 interrupt increments tick every 32 ms tick++; if(tick==33){ i++; //increment counter every 1 second if(i==100) i=0; qq=i/10; // split i into two separate digits rr=i%10; tick=0; }//if INTCON = INTCON & 0xFB; //clear T0IF flag }//interrupt void main() { TRISD= 0x00; PORTD=0x00; ADCON1= 0x06; //PORTA is Digital TRISA = 0x00; // PORTA output, PORTA is used to enable the required 7 segment display to do time multiplexing OPTION_REG= 0x07; //osc clock select, with prescaler of 256 TMR0=0x00; INTCON = 0xA0; //Global Interrupt Enable, Local TMR0 Overflow Interrupt Enable while(1){ if(TMR0&0x40){ PORTA=0x02; // enable the 10’s seven segment PORTD=sevenseg[qq]; else{ PORTA=0x01;// enable the 1’s seven segment PORTD=sevenseg[rr]; }//else }//while }//main //Live Demo: Display a counter from 0 to 99 on a multiple 7 Segments incremented every 1 sec
12
Some simple sensors The microswitch Light-dependent resistors
Optical object sensing Ultrasonic object sensor Hall effect sensor Temperature Sensor
13
The microswitch
14
Light-dependent resistors (LDR)
15
Optical object sensing
Infrared reflective sensor Infrared reflective sensor 1.6V 0.1mA
17
Optical object sensing
Rangefinder IR sensor Measuring range: cm Current consumption: 30mA typical Includes 10" 3-wire cable Supply voltage: V
18
Ultrasonic object sensor
e.g XL-MaxSonar®-EZ™ Sensor Line Component Overview Resolution of 1 cm 10Hz reading rate Read from all 3 sensor outputs: Analog Voltage, Serial, Pulse Width Virtually no dead zone, objects closer than 20 cm range as 20 cm Maximum Range of 765 cm (300 inches) or 1068 cm (420 inches) Operates from V Low 3.4mA current requirement Small, light weight module Designed for easy integration into your project or product Operational Temperature from -40˚C to +70˚C (-40˚F to +160˚F) Real-time automatic calibration (voltage, humidity, ambient noise) Firmware filtering for better noise tolerance and clutter rejection 200,000+ Hours Mean Time Between Failure Retail Price Range: $29.95-$54.95
19
Hall effect sensor
20
Temperature Sensor Microchip - MCP9700/9700A Typical Applications
• Hard Disk Drives and Other PC Peripherals • Entertainment Systems • Home Appliance • Office Equipment • Battery Packs and Portable Equipment • General Purpose Temperature Monitoring
22
Ensuring legal logic levels and input protection
23
Switch debouncing Reading Switches Polling
Use interrupt to read switches
24
Actuators: motors and servos
Brushed DC Motors Brushless DC Motors Stepper Motors Servo Motors
25
Motors Brushed DC Motor Brushless DC Motor Stepper Motor
26
Servo Motors Angular positioning: the ‘servo’
27
Interfacing to actuators
Simple DC switching Reversible switching: the H-bridge
28
Simple DC switching
29
Reversible switching: the H-bridge
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.