Development of a Matlab Data Acquisition and Control Toolbox for PIC Microcontrollers Mechanical Engineering Seminar March 27, 2007 Sang-Hoon Lee Department of Mechanical, Aerospace, and Manufacturing Engineering Polytechnic University, Brooklyn, NY 11201
25
Embed
Development of a Matlab Data Acquisition and Control Toolbox for PIC Microcontrollers Mechanical Engineering Seminar March 27, 2007 Sang-Hoon Lee Department.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Development of a Matlab Data Acquisition and Control Toolbox for PIC Microcontrollers
Mechanical Engineering SeminarMarch 27, 2007
Sang-Hoon LeeDepartment of Mechanical, Aerospace, and Manufacturing Engineering
Polytechnic University, Brooklyn, NY 11201
Matlab Data Acquisition and Control Toolbox for PICs 2007
2
• Background
• Motivation
• Goals
• Prior Research
• Hardware Environment
• Software Environment
• Integration of Simulink and PIC
• Programming the PIC microcontroller
• Illustrative Example
• Conclusion
Outline
Matlab Data Acquisition and Control Toolbox for PICs 2007
3
Background: Data Acquisition
• Data acquisition (DAQ) refers to automatic acquisition of real-world sensory information
• DAQ is used for test instruments, condition monitoring of industrial machinery, process industry, medical instruments, environment monitoring, robotics, etc.
• DAQ can be used to develop virtual instruments for productivity enhancement
Matlab Data Acquisition and Control Toolbox for PICs 2007
4
Background: Data Acquisition and Control• DAQ systems are useful for monitoring and data analysis but if one needs to command a real-
world device into action based on the measurement of some real-world phenomenon, then a DAQ system is not sufficient
In this case one needs a data acquisition and control (DAC) system
• A DAC system
collects data from sensors, and
using computing resources of a PC or an on-board computer processes sensory information, computes control command, and commands control actuators
Matlab Data Acquisition and Control Toolbox for PICs 2007
5
• Peripheral Interface Controllers (PICs)
– Inexpensive microcontroller units (few dollars) that include
• Central processing unit
• Peripherals: memory, timers, and I/O functions
– Provide functionality for multitude of applications (e.g., automobile, consumer
electronics, safety/security, telecommunication)
– Popular in educational, hobby, and industrial applications
Background: PIC
Matlab Data Acquisition and Control Toolbox for PICs 2007
6
• PC-based data acquisition and control (DAC) boards
– High-end DAC boards (e.g., Quanser’s MultiQ3, National Instruments, etc.)
– Advanced hardware capabilities and sophisticated software environment
– Drawback: cost! (high hundreds to few thousand dollars)
Motivation—I
8 Analog Inputs
8 Analog Outputs
8 Encoder Signals
Digital I/Os
Terminal Board
MultiQ3 ISA DAC Board
Matlab Data Acquisition and Control Toolbox for PICs 2007
7
• Data Acquisition and Control (DAC) Boards
– Low-end DAC boards
– Relatively low cost
– Drawback: use proprietary software
– DAC boards supported by Matlab
– Costly and usually include additional hardware features that may not be fully
used (e.g., high sampling rates and high resolution analog to digital converter)
Motivation—II
Matlab Data Acquisition and Control Toolbox for PICs 2007
8
• Create a Matlab DAC toolbox for PIC microcontrollers
– Exploit serial communication capability of PIC microcontrollers and Matlab software
– Use icon-based programming environment of Simulink
– Illustrate the integration of low-cost PIC microcontrollers with Matlab DAC toolbox
environment
• Use the Matlab DAC toolbox to facilitate
– Automatic generation of proper PIC assembly codes for a variety of sensors and actuators
– Automatic programming of the PIC microcontroller
– Data communication between the PIC microcontroller and Matlab
Goals
Matlab Data Acquisition and Control Toolbox for PICs 2007
9
• Basic Stamp 2 (BS2) microcontroller to LabVIEW interface by Radcliffe, 2001
• GUI capabilities for PIC microcontroller via a Matlab interface by Lee et al., 2004
• Matlab data acquisition and control toolbox for BS2 microcontroller by Panda et al., 2004
Prior Research
LabVIEW interface with BS2 Matlab DAC for BS2
Matlab Data Acquisition and Control Toolbox for PICs 2007
10
Hardware Environment
PC and PIC development board
• PIC development board consisting of– PIC16F74 microcontroller with a 20MHz crystal oscillator
– MAX232 with five 1μF capacitors
– DB-9 connector
• PIC development board transmits/receives data to/from a PC via MAX232
• PIC-PG2C programmer– Receives power from the PC’s serial port
– IC-Prog to download PIC HEX code to the PIC microcontroller
PIC-PG2C programmer and PIC
Matlab Data Acquisition and Control Toolbox for PICs 2007
11
• Matlab – An interactive technical computing software