EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / bldc motor

bldc motor

|

Microcontroller › PIC › bldc motor

  • This topic has 0 replies, 1 voice, and was last updated 14 years ago by sanjeev.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • June 3, 2011 at 8:16 am #973
    sanjeev
    Participant

    #define DrivePort PORTC

    #define SensorMask B’00000111’

    #define SensorPort PORTE

    #define DirectionBit PORTA, 1

    Commutate

    movlw SensorMask ;retain only the sensor bits

    andwf SensorPort ;get sensor data

    xorwf LastSensor, w ;test if motion sensed

    btfsc STATUS, Z ;zero if no change

    return ;no change – return

    xorwf LastSensor, f ;replace last sensor data with current

    btfss DirectionBit ;test direction bit

    goto FwdCom ;bit is zero – do forward commutation

    ;reverse commutation

    movlw HIGH RevTable ;get MS byte to table

    movwf PCLATH ;prepare for computed GOTO

    movlw LOW RevTable ;get LS byte of table

    goto Com2

    FwdCom ;forward commutation

    movlw HIGH FwdTable ;get MS byte of table

    movwf PCLATH ;prepare for computed GOTO

    movlw LOW FwdTable ;get LS byte of table

    Com2

    addwf LastSensor, w ;add sensor offset

    btfsc STATUS, C ;page change in table?

    incf PCLATH, f ;yes – adjust MS byte

    call GetDrive ;get drive word from table

    movwf DriveWord ;save as current drive word

    return

    GetDrive

    movwf PCL

    FwdTable

    retlw B’00000000’ ;invalid

    retlw B’00010010’ ;phase 6

    retlw B’00001001’ ;phase 4

    retlw B’00011000’ ;phase 5

    retlw B’00100100’ ;phase 2

    retlw B’00000110’ ;phase 1

    retlw B’00100001’ ;phase 3

    retlw B’00000000’ ;invalid

    RevTable

    retlw B’00000000’ ;invalid

    retlw B’00100001’ ;phase /6

    retlw B’00000110’ ;phase /4

    retlw B’00100100’ ;phase /5

    retlw B’00011000’ ;phase /2

    retlw B’00001001’ ;phase /1

    retlw B’00010010’ ;phase /3

    retlw B’00000000’ ;invalid

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Siemens large industrial PLC parts June 15, 2025
  • Parts required for a personal project June 15, 2025
  • Cant log in to Easy PC forum June 15, 2025
  • Failure of polypropylene motor-run capacitors June 15, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 15, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise