0% found this document useful (0 votes)
17 views8 pages

Av 314 Lab 7 Group 3

antenna micropatch

Uploaded by

no one
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

Av 314 Lab 7 Group 3

antenna micropatch

Uploaded by

no one
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

AV 314

LAB REPORT 07
GROUP 03
DC MOTOR SPEED CONTROL USING PIC MICROCONTROLLER IN PROTEUS
SUBMITTED BY:
A/C SHAYAN BAIG 21097004

A/C ALI SULTAN 21097039

A/C DANIYAL 21097032

SUBMITTED TO:
LE FAZAL UR REHMAN
AIM:
The aim of this lab is to control the DC motor speed using PIC 18F4550 microcontroller in proteus.

QUESTION NO 1)
Simulate a DC motor speed control while displaying its speed on LCD using PIC18F4550
microcontroller on Proteus.

PSEUDO CODE:
The pseudo code is given by:

// LCD module connections

Define LCD_RS at RD0_bit

Define LCD_EN at RD2_bit

Define LCD_D4 at RD4_bit

Define LCD_D5 at RD5_bit

Define LCD_D6 at RD6_bit

Define LCD_D7 at RD7_bit

Define LCD_RS_Direction at TRISD0_bit

Define LCD_EN_Direction at TRISD2_bit

Define LCD_D4_Direction at TRISD4_bit

Define LCD_D5_Direction at TRISD5_bit

Define LCD_D6_Direction at TRISD6_bit

Define LCD_D7_Direction at TRISD7_bit

// LCD module connections end

Initialize variables

temp as integer

txt as character array of size 15

current_duty1 as unsigned short

Start of main program

Disable comparators (CMCON |= 7)

Set RC1 and RC2 as output (TRISC.RC1 = 0, TRISC.RC2 = 0)

Initialize PWM1 and PWM2 with 5KHz frequency

Initialize LCD

Clear LCD display


Turn off LCD cursor

Display "DC Motor Rpm:" on LCD first row

Start infinite loop

Start PWM1

Stop PWM2

Set PORTC to binary 00000010

Set current_duty1 to 250

Set PWM1 duty cycle to current_duty1

Set temp to 150

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 120

Set PWM1 duty cycle to current_duty1

Set temp to 120

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 90

Set PWM1 duty cycle to current_duty1

Set temp to 90

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 60

Set PWM1 duty cycle to current_duty1

Set temp to 60

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Stop PWM1
Start PWM2

Stop PWM1

Set PORTC to binary 00000100

Set current_duty1 to 150

Set PWM2 duty cycle to current_duty1

Set temp to 150

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 120

Set PWM2 duty cycle to current_duty1

Set temp to 120

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 90

Set PWM2 duty cycle to current_duty1

Set temp to 90

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Set current_duty1 to 60

Set PWM2 duty cycle to current_duty1

Set temp to 60

Convert temp to string and store in txt

Display txt on LCD second row

Wait for 3000 ms

Stop PWM2

End of infinite loop

End of main program

CODE:
The Hex file code for controlling DC Motor speed is given by:
PROTEUS MODEL:
The proteus model is given as:

The motor speed is controlled by varying the duty cycle of the PWM signals applied

to the motor driver. The duty cycle determines how much power is delivered to the motor,

thus controlling its speed. Higher duty cycles mean higher speeds and lower duty cycles

mean lower speeds. The above hex file code alternates between different duty cycles to

demonstrate changing speeds and directions.

You might also like