Presentation is loading. Please wait.

Presentation is loading. Please wait.

July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon.

Similar presentations


Presentation on theme: "July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon."— Presentation transcript:

1 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon Dynamic Systems & Control Group Center of Magnetic Recording Research UCSD, Dept. of MAE Email: callafon@ucsd.edu COSMOS LECTURE

2 2 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Introduction Micro Processor: combination of Processor (for computing) Input/Output functionality RAM (Random Access Memory) ROM (Read Only Memory) (FLASH or EPROM) Mostly “all on one chip”

3 3 July 18, 2008COSMOS @ UCSD - R.A. de Callafon In this COSMOS cluster we are using a micro processor for: Process measurement data Timing events (when a ball passes by) Count how many balls came by Compute what velocity was Display result on LCD screen Make a sound Send out control signals Turn a servo motor Turn of/off a switch or actuator Introduction

4 4 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of a Micro Processor

5 5 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of a Micro Processor Functionality depends on “brand” (Intel, HP, MicroChip, Motorolla) Peripheral interface General items in micro processor: Can be programmed! Arithmetic Functionality Timers Interface with Peripherals Digital In and Out signals Analog In signals Pulse Width Modulation Out

6 6 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Micro Processor in your Kinetic Sculpture Box: Peripheral Interface Controller Micro Processor Some details: PIC made by MicroChip Reduced Instruction Set Computing (RISC) HARVARD memory (separation between program and variables) (Only) needs power + clock (oscillator) to operate

7 7 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Arithmetic Functionality Adding, subtracting and multiplying integer numbers Adding, subtracting and multiplying real numbers via “emulation”: means a lot of computing time In general only fixed point precision, compared to floating point precision Floating point computations: co-processor needed…

8 8 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Timers Timers increment and decrement on the basis of clock (oscillator) Use to time events! Oscillator = clock and value can be retrieved and stored in memory Example: speed sensors Measure clock at first passing of sensor Measure clock at second passing of sensor Time = difference in timer Velocity = distance/time

9 9 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Interface with Peripherals Write to the LCD screen Turn on/off certain LED’s (digital out signals) Some example code of LCD writing: LCD = variable defined in file VARIABLES serout = command to write to a serial port

10 10 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Help on programming: We use an friendly IDE (Integrated Development Environment) Pressing F1 will open help Look for command (serout) Read documentation Many examples on COSMOS website!

11 11 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Digital I/O signals PIC microprocessor in box has over 30 connection pins COSMOS controlbox has 3 digital input pins DA, DB and DC Each pin can be programmed to be an Digital Input or Digital Output Digital I/O: Only 2 values: 0 and 1 0 corresponds to low voltage < 0.5 Volt 1 corresponds to high voltage > 3.8 Volt Combining digital I/O data yields numbers!

12 12 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Examples of use Digital I/O signals: Digital I/O signal to detect events Position measurement of ball: When ball passes sensor, pin # becomes “low” or “high” Velocity measurement of ball: Measure time (using timer) when ball passes two sensors Digital /IO signal as numbers Consider 8 digital Input channels (on port D) with: Combining them gives what (decimal) number?

13 13 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Analog I/O signals COSMOS controlbox has 3 analog input pins AD0, AD1 and AD2 Microprocessor converts analog input signal to a number of bits number This process is called AD conversion (Analog to Digital Conversion) Important parameters in AD conversion: Number of bits or resolution (typically 8 bits) Speed of AD conversion

14 14 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Examples of use Analog I/O signals: Analog I/O signal to measure “user input” Position of a potentio meter (variable resistor) Varying voltage signal from a sensor Resolution Consider a AD conversion that will convert a signal between 0 and 5 Volt to an 8 bit number. What will be the resolution?

15 15 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Combination of I/O signals + computations: Measurements & Actuation Physics experiments Move a servo motor Detection To see if your kinetic sculpture is working properly Time events Automation (most interesting part) Process certain events automatically! Process user input automatically!

16 16 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Automation Principles of Automation are based on Combining Measurement and Actuation Feedback (remember labtour to the control laboratory)! Formats of Feedback On/Off actuation Fuzzy actuation Continuous actuation

17 17 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Functionality of Micro Processor Microprocessor makes this active KS work: measure ball velocity with optical sensor actuate stepper motor

18 18 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor Programming via Assembly code (RISC) Very hard to understand (at first) Code hard to maintain C code (high level) A bit easier to understand Easier for maintenance P basic or Q basic (based on BASIC like language) Easy to understand Not so easy for large projects

19 19 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor Write your code in basic via BasicMicro IDE Compile code and see if there any errors Download (burn flash memory) onto microprocessor Test and debug code (can also be done before downloading)

20 20 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor Main ingredients in code Definition of constants (I/O pins and memory) Definition of variables + type bit 0 to 1 byte 0 to 255 sbyte -127 to 128 word 0 to 65535 sword -32767 to 32768 long -2147483647 to 2147483648 float (*not used in this course*) comments name type

21 21 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor Main ingredients in code If statements: Initializations & computations:

22 22 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor Main ingredients in code Setting up timers with interrupt: Define interrupt function:

23 23 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Simulation of Micro Processor Simulation in Working Model: actuate catching! Change force, depending on measurement of velocity (more in next lecture on dynamics)

24 24 July 18, 2008COSMOS @ UCSD - R.A. de Callafon Programming a Micro Processor example code(s) explained by Alex Simpkins ExampleExample of BAS code TutorialTutorial on how to write a program


Download ppt "July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon."

Similar presentations


Ads by Google