×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

### Create a StudySoup account

#### Be part of our community, it's free to join!

or

##### By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

by: Jack

40

9

4

# Pulse Width Modulation ECE3720

Jack
UCSC

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

### Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

Pulse Width Modulation lab report code
COURSE
PROF.
Staff
TYPE
Class Notes
PAGES
4
WORDS
KARMA
25 ?

## Popular in Electrical Engineering

This 4 page Class Notes was uploaded by Jack on Monday April 4, 2016. The Class Notes belongs to ECE3720 at University of California - Santa Cruz taught by Staff in Spring 2016. Since its upload, it has received 40 views. For similar materials see in Electrical Engineering at University of California - Santa Cruz.

×

## Reviews for Pulse Width Modulation

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 04/04/16
Pulse Width Modulation (PWM) OBJECTIVE:  This lab objective is to intea DC motor with a Pulse Width Modulator, and connect the DC motor to the TD62003 driver chip and write a program to control the speed of the DC motor. EQUIPMENT USED: Freescale PBMCUSLK Student Learning Kit; Current Driver Chip (TD62003) ; Small DC Motor. PROCEDURE:  Firstly, I wired the motor and current driver and connect is to the specified PWM channel. The pin of TD62003 driver chip is shown below(figure 1). Then design a C program (shown in the code section) to control the speed of the DC motor, My TA have given us a template of the C code, which is include all initialized value. The part we need do is to write the loop and the interrupts, which can display the various speed on the LCD, and can use the port T to change the speed of the DC motor. In addition, I start the motor at the following duty: 0 % ; 25 %; 50 %; 75 %; 100 %. Figure 1: pin connection of TD62003 driver chip PROBLEMS:  During the lab, The problems I ran into first was that wrong connection to the connector of the Motorola chip because the digital is not clear on it. So there was no happen when press the port T. Then I corrected the wire connection, but there was something wrong make the LCD display nothing. I checked the code, and found in the loop I write all case to LCDPutChar(), so It can not display the string like “100”. When this was corrected, the program began working properly. CONCLUSION:  From this lab, I learned how to use the PWM to control the speed of the DC motor. For PWM is also a deeper understanding of the role, These are really useful to help me study the course. Code: #include <hidef.h>      /* common defines and macros */ #include <mc9s12dt256.h>     /* derivative information */ //#include "pbs12dslk.h" #include "lcd.h" #pragma LINK_INFO DERIVATIVE "mc9s12dt256" volatile unsigned char duty = 50; void main(void)  { int j,k; DDRP = 0x02;   DDRJ = 0x00;  PERJ = 0x80; PPSJ = 0x00; PIEJ = 0x80; PIFJ = 0x80; PTP_PTP1 = 1; PWMPRCLK = 0x07; PWMSCLA = 0x0F; PWMCLK_PCLK1 = 1; PWMPOL_PPOL1 = 1; PWMCAE_CAE1 = 0; PWMPER1 = 100;// just use 100 here, for now dont bother about the time period PWME_PWME1 = 1; PWMDTY1 = duty; //equals 50 LCDInit(); LCDClearDisplay(); LCDPutChar('5'); LCDPutChar('0'); EnableInterrupts; while (1) {    LCDClearDisplay();    switch(duty)    {     case 0:LCDPutChar('0');break;     case 25:LCDPutString("25");break;     case 50:LCDPutString("50");break;     case 75:LCDPutString("75");break;     case 100:LCDPutString("100");break;        }    for (j=0;j<=1000;j++)       for (k=0;k<=1000;k++);    }   } void interrupt 24 PORTJ_ISR() { DisableInterrupts; duty = duty + 25; if(duty > 100) { duty = 0; } PWMDTY1 = duty; PIFJ = 0x80; EnableInterrupts; }

×

×

×

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Anthony Lee UC Santa Barbara

#### "I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Steve Martinelli UC Los Angeles

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.