Laboratory: Introduction to Mechatronics Instructor TA: Edgar Martinez Soberanes (eem370@mail.usask.ca) 2015-02-09 Lab 3. Analog Discovery Lab Sessions Lab 1. Introduction – Read manual and become familiar with the operation and components of the car. Lab 2. Assemble the Mechanical and Electrical components of the car. Lab 3. Install the Software, debug the electronics and run the tutorial program. Lab 4. Program and run the sample programs for each module. Lab 5. Program the run the main software module to run the car and fine tune the car. Lab 6. Write up report and run the car on the test track and determine its performance. 2 Lab 3. Analog Discovery And Programming Outline Objective. Lecture. o Analog Discovery o Programming Delay sequence Analog Discovery Practice. Assemble car and install programs. 3 Objective Develop an understanding of the Analog Discovery tool (USB Oscilloscope) Design a circuit with a gain of two to increment a signal. Develop an understanding of a delay sequence. 4 Analog Discovery 2-Channel Oscilloscope 2-Channel Waveform Generator 16-Channel Logic Analyzer 16-Channel Digital Pattern Generator ±5VDC Power Supplies Spectrum Analyzer Network Analyzer Voltmeter Digital I/O Supported by MATLAB / MATLAB student edition 5 Introduction video Device test as shown in the video. 6 Electrical Circuit Generate an input signal for your circuit: 1.2sin(60 ) 7 Build and test a circuit to amplify a signal by two. Battery Input signal DC-DC converter Output signal OP-AMP 8 Circuit components. DC-DC Converter (Op-Amp works with an feed power of between 5-15 volts) 9 LMC660-CMOS Quad Operational Amplifier 10 Result 11 Programming: Delay sequence 20 PIC´s Internal Clock: 20MHz = 20 10 12 Delay Example 13 14 Programming the PIC 15 Programming Cycle 16 How to program the PIC Open folder mpasmx Create a new folder called ME475 (Here you are going to save all your projects). Remember to save your program file as, example.asm (do not use spaces and try to use short names) 17 Open MPASMX 18 Select program.asm file 19 Click on Assemble. 20 You have generated a .HEX file (example.hex) which is the file to be load into the PIC 21 Downloading the program Connect the car to the computer, and set the program switch on PRG 22 Open the software B77-TB 23 Erase previous program and load the file.HEX 24 Program the PIC 25 Running the program on the PIC Turn the Program switch to RUN, and push the RED button. 26 Thanks 27