Sunteți pe pagina 1din 2

Subject: Student: Practice Name Practice Number OBJECTIVE (Learning result)

DIGITAL SYSTEMS 2

USING CAPTURE & COMPARE AND PWM /MODULE 6 Length (Hours) 4

In the first part of the practice the student will be able to configure frequency and duty cycle of the Pulse Width Modulation Module included on the PIC18F4550; in the second part, the student will be able to measure the pulse width from an external generator.

THEORETICAL FRAMEWORK Explain the concept Duty Cycle Explain how PWM is generated using discrete components

MATERIALS AND EQUIPEMENT

Software: PICC Compiler, Proteus 1 DC motor 1 Protoboard METHODOLOGY Part 1

1 5V DC Power Source 1 PIC18F4550 2 33pF Capacitors

1 XT 4MHz 1 Resistor 10K 1 Osciloscope

1 Trimpot 10K 1 LCD 1 AC light bulb

1. Write down the code to generate two independent PWM outputs with a fixed frequency of 1500 Hz. PWM1 Output will have a 15% duty cycle and the PWM2 65%. 2. Simulate this program and measure frequency and duty cycle with oscilloscope included in ISIS7. (Check point 1) 3. Write down the code to acquire the voltage from a trimpot connected to the channel 0 of the ADC configured with an 8 bits resolution. 4. Show the digital value on an 16x2 LCD and add another trimpot connected to channel 1 of the ADC 5. Modify the program to make possible the change of the PWM duty cycle by means of varying the voltage on the ADC channels 0 and 1. 6. Wire the circuit and show this variation on the LCD 16x2. (Check point 2) 7. Design a power stage to control the speed of one DC motor by varying the voltage of the trimpot on AN0 for PWM1, and to control de light intensity of an AC incandescent bulb on AN1 for PWM2. (Check point 3)

8. Program the code to control the position for a servo-motor MOTOR PWM-SERVO and simulate it on the ISIS 7 Software. (Check Point 4) Part 2 1. Configure the module Capture and Compare (CCP1 and CCP2) as inputs. 2. Use a function generator as a PWM generator and connect either PWM1 or PWM2 outputs to the CCP1 and CCP2 terminals. Then vary the duty cycle and frequency and show them in lines 1 and 2 in the LCD16x2. Wire the circuit. (Check point 5)

PRACTICE EVALUATION QUESTIONARY 1. What does the function setup_ccp1() do? 2. Explain the fields on the function setup_timer_2() 3. What does the function set_pwm1_duty() do? 4. Is it possible to connect directly a DC motor to the PWM outputs of a microcontroller PIC18F4550? 5. Which is the lowest configurable frequency for the PWM? 6. Explain another way of varying the speed of a motor that you know. 7. Which are the advantages of using PWM? 8. Which is the highest configurable frequency for the PWM? 9. Which is the difference when using the lowest or highest frequency when controlling the speed of a motor? 10. Which is the smallest and which is the largest pulse width that the CCP1 & CCP2 can measure?

Conclusions (Results interpretation, Was the objective reached? Possible applications, etc.)

S-ar putea să vă placă și