View Index by Level
RANDOM PAGE

SITE SEARCH

LOG
IN

SIGN UP

HELP

PWM Motor


This is the AQA version closing after June 2019. Visit the the version for Eduqas instead.

To gain access to revision questions, please sign up and log in.

A2

Pulse Width Modulation Motor Speed Control

This image shows the Picaxe chip generating pulses of decreasing width.
This has the effect of slowing the conncted motor from 100% speed down to zero%.

Pulse Width Modulation

Here is a MOSFET motor driver.

Pulse Width Modulation

The Circuit Diagram

PWM Driver Circuit Diagram

And Finally the Code

    SYMBOL  COUNTER1 = B0
    SYMBOL  COUNTER2 = B1

INIT:
    COUNTER1 = 50    ; CONTROL THE PULSE HIGH TIME
    COUNTER2 =  0    ; CONTROL THE PULSE LOW TIME
    
START:
    DEC     COUNTER1 ; REDUCE THE HIGH PULSE WIDTH
    JPZ     INIT     ; NOTICE WHEN COUNTER1 HAS REACHED ZERO

    MOVW    0X01     ; SET OUTPUT HIGH
    MOVWR   PORTB    ; MOTOR IS CONNECTED TO PORTB
    MOVRW   COUNTER1 ; USED TO TIME THE HIGH PULSE
LOOP1:
    JPZ     NEXTBIT  ; IF ZERO, DO THE NEXT BIT
    SUBW    1        ; COUNT DOWN TOWARDS ZERO
    JMP     LOOP1    ; JUMP BACK TO CARRY ON COUNTING DOWN
    
NEXTBIT:
    INC     COUNTER2 ; INCREASE THE LOW PULSE WIDTH

    MOVW    0X00     ; SET MOTOR OUTPUT LOW
    MOVWR   PORTB    ; MOTOR IS CONNECTED TO PORTB
    MOVRW   COUNTER2 ; USED TO TIME THE LOW PULSE
LOOP2:
    JPZ     START    ; IF ZERO, JUMP TO THE START
    SUBW    1        ; COUNT DOWN TOWARDS ZERO
    JMP     LOOP2    ; JUMP BACK TO CARRY ON COUNTING DOWN

 

 

 

reviseOmatic V3     Contacts, ©, Cookies, Data Protection and Disclaimers Hosted at linode.com, London