BLDC DRIVE USING AN OPTICAL ENCODER

Similar documents
The following document contains information on Cypress products.

Jasmine Sub-board Limitation MB87P2020-A

Video Input of MB86291

Netzer AqBiSS Electric Encoders

Fast Quadrature Decode TPU Function (FQD)

EM1. Transmissive Optical Encoder Module Page 1 of 9. Description. Features

MICROMASTER Encoder Module

Designing Intelligence into Commutation Encoders

SDI-HDRPTPRO. User Manual. HD-SDI Repeater with Signal Equalization & Re-clocking. Version 1.2

EM1. Transmissive Optical Encoder Module Page 1 of 8. Description. Features

EM1. Transmissive Optical Encoder Module Page 1 of 8. Description. Features

UNIT V 8051 Microcontroller based Systems Design

Table of Contents. Introduction Pin Description Absolute Maximum Rating Electrical Specifications... 4

(Catalog No HSCE) Product Data

RG NDT INTERNATIONAL INC

SDI-HDSDXPRO. USER MANUAL Version 1.1

Noise Detector ND-1 Operating Manual

Setup Guide. Introduction

DMC550 Technical Reference

DIRECT DRIVE ROTARY TABLES SRT SERIES

STEVAL-IHM043V1. 6-step BLDC sensorless driver board based on the STM32F051 and L6234. Features. Description

ni.com Sensor Measurement Fundamentals Series

SDI-SDHDXPRO User Manual. Version1.2

User Manual. AtlonA. 1 x 10 VGA with Stereo Audio Distribution Amplifier over CAT5/6 compatible with AT-VGA300RL AT-VGA10SS

Setup Guide. Introduction

Published in A R DIGITECH

Fits the Leopard Family FREQ./RPM INPUT MODULE WITH 24 V EXC.

HDSP2X4. HDMI 2 x 4 Splitter with Full HD 1080p

USER MANUAL HDMI 1x4 Distribution Amplifier w/ CAT5e/6 outputs up to 394ft. (120 meters)

Model: HDCMP31. Installation Guide

AtlonA. HDMI/DVI to Composite and S-Video Down-Converter AT-HD530. User Manual

ED3. Digital Encoder Display Page 1 of 13. Description. Mechanical Drawing. Features

User Manual. AtlonA. HDMI to VGA/COMPONENT and Stereo Audio Format Converter (Not HDCP Compatible) AT-HD420

User Manual. AtlonA COMPOSITE VIDEO (BNC) + STEREO AUDIO TO HDMI VIDEO FORMAT CONVERTER AND SCALER AT-HD120

Revision 1.2d

Documentation. Magnetic Encoder System (MES) Version: Date:

Enable-IT 865 Q PRO Gigabit Professional Grade PoE Extender Kit Quickstart Guide

Precision TNC Coaxial Calibration Kit

1 x 10 Component Video with Stereo and Digital Audio Distribution Amplifier over CAT5/6 compatible with AT-COMP300RL AT-COMP10SS

Encoders - Measuring rotation of a wheel or

Atlona HDBaseT-Lite Transmitter over Single CAT5e/6/7

Enable-IT 860C PRO Coax Gigabit Professional Grade Ethernet Extender Kit Quickstart Guide

IoT Toolbox Mobile Application User Manual

Flarm LED indicator. Version 1.13

Electric Rotary Modules. Rotary Actuators

USER MANUAL FOR THE ANALOGIC GAUGE FIRMWARE VERSION 1.1

Linear Probe Encoder Page 1 of 7. Description. Features

Microincrements IP67-related solutions

User Manual. AtlonA. Passive VGA Extender with Wall Plate or Box options up to 330ft over 1 x CAT5/6/7 Cable AT-VGA100-SR and AT-WPVGA-SR AT-WPVGA-SR

USER MANUAL FOR THE ANALOGIC GAUGE FIRMWARE VERSION 1.0

PSM-003. Micro Polarization Controller/Scrambler. User Guide

SP-HD1X24K. 1x2 HDMI Splitter with 4K Cinema resolutions & EDID

SM-Universal Encoder Plus. EF User Guide. Solutions module for Unidrive SP

User Manual. VGA to Component or Component to VGA Converter Scaler AT-VGA300CV

Application Note AN-708 Vibration Measurements with the Vibration Synchronization Module

Enable-IT 821P PoE Extender Quickstart Guide Professional Grade Networking

Counter/timer 2 of the 83C552 microcontroller

Manual. Analog (U/I) Sendix M3661 / M3681. Sendix M3661R. Sendix M5861. Absolute multiturn encoder. Order code: 8.M36X1.XXXX.XX12

Model: UHD41-ARC. Installation Guide

Model: HD41-ARC. Installation Guide

With Latency Killer TM Technology. Model LK-Solo. HP Amp 2x2 Loop Thru Mixer

Enable-IT 865 PRO Rev E Gigabit PoE Extender Kit Quickstart Guide Professional Grade Networking

PCI Express JPEG Frame Grabber Hardware Manual Model 817 Rev.E April 09

Enable-IT 860 PRO Rev C Gigabit Professional Grade Ethernet Extender Kit Quickstart Guide

STEVAL-IHM008V1. BLDC & AC motor control Power board SEMITOP 2 1kW. Features. Applications

KHT 1000C HV-Probe Calibrator. Instruction Manual

This document describes a program for 7-segment LED display (dynamic lighting).

EXT-SDHDX. Mini SDI to HDMI Converter

SW-HD3X14K. SW-HD3X14K 3x1 HDMI Switcher with 4K Support

E8Y. Micropressure Sensor with Easy-to-Read Digital Display. Differential Pressure Sensor. Ordering Information. Sensors

Step-Lok Manual V1.0 (preliminary) Last edited Feb 23 / 2015

Enable-IT Port Extended Gigabit Ethernet DSLAM Quickstart Guide

1 x 3 Component Video W/Audio Distribution Amplifier AT-COMP-13AD

User Manual. June 30, Copyright 2004 Canopus Co., Ltd. All rights reserved.

Using the Synchronized Pulse-Width Modulation etpu Function by:

HDMI 1.4 OVER SINGLE CAT5/6/7 EXTENDER WITH BI-DIRECTIONAL IR and RS232 TRANSMITTER & RECEIVER AT-HD4-100SR

Enable-IT 824WP Outdoor Waterproof PoE Extender Kit Quickstart Guide Professional Grade Networking

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

32 Channel CPCI Board User Manual

User Manual. 1x8 S-Video Distribution Amplifier With Stereo Audio AT-SAV18

Electronic M.O.P Card. Instruction Manual Model D

Instruction Manual. 2.4G Digital Wireless Four Channel Transmitter System RVS-554W. Reverse With Confidence 1

Enable-IT 865W PRO Gigabit Professional Grade PoE Extender Kit Quickstart Guide

This document describes a program for 7-segment LED display (dynamic lighting) and key matrix and input.

Enable-IT 860 PRO Rev D Gigabit Ethernet Extender Kit Quickstart Guide Professional Grade Networking

Exercise 4-2. Counting of Actuator Cycles EXERCISE OBJECTIVE & & &

Cryoelectronics. MS-FLL User s Manual. Mr. SQUID Flux-Locked Loop. STAR Cryoelectronics 25 Bisbee Court, Suite A Santa Fe, NM U. S. A.

PAD-2 2 Channel A-D Converter Mk2 Rev. 3 Sept. 24, 2017

LavryBlack Series Model DA10 Digital to Analog Converter

Triple RTD. On-board Digital Signal Processor. Linearization RTDs 20 Hz averaged outputs 16-bit precision comparator function.

Single Axis Position Controller

FOTS100 User Manual. BIOPAC Systems, Inc. Opsens Inc. 42 Aero Camino, Goleta, CA Tel (805) , Fax (805)

Low Voltage Multifunctional LED Controller / DMX Decoder. Specification

Model Number ALS-ELUM-RGB-CNTRL-1. elum RGB Controller

VLT AutomationDrive FC 301/FC 302

Enable-IT Port Extended Gigabit Ethernet PoE DSLAM Quickstart Guide

34MD Series. Motor/Driver Combination. User s Guide E. Landon Drive Anaheim, CA

Sprite TL Quick Start Guide

NI-DAQmx Device Considerations

Figure 1: AHK1421 Evaluation Board Pictures.

Transcription:

Fujitsu Microelectronics Europe Application Note MCU-AN-300018-E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91265 SERIES BLDC DRIVE USING AN OPTICAL ENCODER APPLICATION NOTE

Revision History Revision History Date 2007-03-05 CHa First release Issue This document contains 13 pages. MCU-AN-300018-E-V10-2 - Fujitsu Microelectronics Europe GmbH

Warranty and Disclaimer Warranty and Disclaimer To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH restricts its warranties and its liability for all products delivered free of charge (e.g. software include or header files, application examples, target boards, evaluation boards, engineering samples of IC s etc.), its performance and any consequential damages, on the use of the Product in accordance with (i) the terms of the License Agreement and the Sale and Purchase Agreement under which agreements the Product has been delivered, (ii) the technical descriptions and (iii) all accompanying written materials. In addition, to the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH disclaims all warranties and liabilities for the performance of the Product and any consequential damages in cases of unauthorised decompiling and/or reverse engineering and/or disassembling. Note, all these products are intended and must only be used in an evaluation laboratory environment. 1. Fujitsu Microelectronics Europe GmbH warrants that the Product will perform substantially in accordance with the accompanying written materials for a period of 90 days form the date of receipt by the customer. Concerning the hardware components of the Product, Fujitsu Microelectronics Europe GmbH warrants that the Product will be free from defects in material and workmanship under use and service as specified in the accompanying written materials for a duration of 1 year from the date of receipt by the customer. 2. Should a Product turn out to be defect, Fujitsu Microelectronics Europe GmbH s entire liability and the customer s exclusive remedy shall be, at Fujitsu Microelectronics Europe GmbH s sole discretion, either return of the purchase price and the license fee, or replacement of the Product or parts thereof, if the Product is returned to Fujitsu Microelectronics Europe GmbH in original packing and without further defects resulting from the customer s use or the transport. However, this warranty is excluded if the defect has resulted from an accident not attributable to Fujitsu Microelectronics Europe GmbH, or abuse or misapplication attributable to the customer or any other third party not relating to Fujitsu Microelectronics Europe GmbH. 3. To the maximum extent permitted by applicable law Fujitsu Microelectronics Europe GmbH disclaims all other warranties, whether expressed or implied, in particular, but not limited to, warranties of merchantability and fitness for a particular purpose for which the Product is not designated. 4. To the maximum extent permitted by applicable law, Fujitsu Microelectronics Europe GmbH s and its suppliers liability is restricted to intention and gross negligence. NO LIABILITY FOR CONSEQUENTIAL DAMAGES To the maximum extent permitted by applicable law, in no event shall Fujitsu Microelectronics Europe GmbH and its suppliers be liable for any damages whatsoever (including but without limitation, consequential and/or indirect damages for personal injury, assets of substantial value, loss of profits, interruption of business operation, loss of information, or any other monetary or pecuniary loss) arising from the use of the Product. Should one of the above stipulations be or become invalid and/or unenforceable, the remaining stipulations shall stay in full effect Fujitsu Microelectronics Europe GmbH - 3 - MCU-AN-300018-E-V10

Contents Contents REVISION HISTORY... 2 WARRANTY AND DISCLAIMER... 3 CONTENTS... 4 1 INTRODUCTION... 5 2 ENCODER BASICS... 6 3 ENCODER DRIVE FOR BLDC MOTORS... 7 4 INCREASING THE SPEED RANGE FOR THE ENCODER PROCESSING... 9 5 CONNECTING AN ENCODER TO THE MOTORKIT-91F267-MC... 10 6 SOURCE CODE SEGMENTS... 11 7 APPENDIX... 13 7.1 Figures... 13 7.2 Related Documents... 13 7.3 Related software examples... 13 MCU-AN-300018-E-V10-4 - Fujitsu Microelectronics Europe GmbH

Chapter 1 Introduction 1 Introduction Incremental encoders are used in a wide range of applications, like data input wheels ( jogshuttle type) and replacement for potentiometers or pushbuttons for all kind of equipment. Since these elements are turned by hand, the resulting speed is not very high. But incremental encoders are also commonly used in motion control, as rotary or linear position sensor. Since the speed to be measured in these systems can be very high, also the resulting pulse frequency rises accordingly. If the quadrature interface is implemented in software and not by a dedicated up/down counter, this can generate a high interrupt load for the MCU. This application note will show a possibility to use an incremental encoder at high speeds using the MCUs Input Capture unit. A software example to drive a brushless DC motor using the MB91F267 MCU on the MotorKit-91F267-MC is bundled with this document. Fujitsu Microelectronics Europe GmbH - 5 - MCU-AN-300018-E-V10

Chapter 2 Encoder basics 2 Encoder basics The basic principle of a rotary encoder is described in the Fujitsu application note mcu-an- 390055-e-v12-rotary_encoder, which can be found at the web address stated at the end of this document. The mentioned application note shows different methods to evaluate the encoder signal and the connection of an incremental encoder using either the external interrupts or the input capture pins of the MCU. Since the ICU variant offers several advantages such as trigger on both edges and simple time measurement as a side effect, only this method is treated in this document. The output signal of an incremental encoder basically consists of two rectangular waveforms with 50% duty, which are orthogonal (displaced by 90 ) to each other ( quadrature encoder). By the sequence of the four possible states of the encoder output, the movement direction can be determined, and the time between two transitions yields the speed. Figure 1: Incremental encoder signal The resolution of a rotary encoder is measured in pulses or lines per round. A common value for mid-range encoders is 500 lines per revolution, which results in 2000 state changes per round. Many encoders offer an additional index signal, e.g. a zero index of a rotary encoder, to allow absolute positioning (after the first index occurred). To keep the absolute position value also after power-down, either the position has to be stored in a non-volatile memory, or if this is not possible or necessary, either a homing operation has to be performed, or a rough position estimate has to be made for the first turn, e.g. by hall sensors. As soon as the first index signal appears, the exact position is known. The actual position count can also be compared to the expected value in the routine processing the zero index signal, e.g. to recognize and correct errors due to noise on the A and B signals. MCU-AN-300018-E-V10-6 - Fujitsu Microelectronics Europe GmbH

Chapter 3 Encoder drive for BLDC motors 3 Encoder drive for BLDC motors There are many applications for incremental or absolute encoders in motor- and motion control. Often, optical incremental encoders are directly mounted on the motor shaft and can be used for precise rotor angle measurement, needed for many control algorithms. An easy way of driving a PMSM (Permanent Magnet Synchronous Motor) or BLDC (Brushless DC) motor with sinusoidal currents is to use the position calculated by the encoder routine as direct index for sine generation using a lookup table. Ideally, a BLDC or PMSM delivers the most torque when the magnetic field generated by the rotors permanent magnets and the stator field are orthogonal to each other. So, for a simplified case, an offset of 90 electrical degrees is added to the rotor position and thereby gives the ideal phase for the stator currents. These can be generated with a sine lookup table, generating the three phase outputs with 120 degree offset between each other. Also the relative position of the encoder zero index to the stator Phase A is a constant offset that must be included. For a 2-pole motor, the described method is directly applicable, but for n pole pairs, one encoder revolution represents n electrical rotations of the stator field, so the position has to be scaled. This also reduces the effective encoder resolution for each electrical rotation. Since this method does not require measurement of the three phase currents and uses only a few calculations like scaling of the sine values and some phase shifts, it is easy to understand and to implement. By varying the offset angle between the encoder position and the generated phase voltages, even a variant of field weakening can be realized, also known as phase advance in some (mostly block commutated) BLDC drives. Thereby, the motor speed can be increased at reduced torque. With some adjustments on the phase offset, a quite efficient motor rotation can be achieved over a wide speed range. Further efficiency can be gained, when a sine table with third harmonics injection is used instead of a pure sine wave. As the name implies, a small amount of an additional sine wave with a three-time higher frequency is added, resulting in a higher phase voltage and better usage of the DC bus voltage. The resulting phase voltage is still sinusoidal, since the third harmonics are in phase on all phase terminals and thereby generates no voltage in the motor phases. Figure 2: Pure sine voltages Figure 3: Sine + 3rd harmonics Of course, this simple mechanism cannot deliver the same performance as real field orientated control. Since the ideal angle between rotor position and stator field is speed- and load dependant in reality, a constant offset delivers less efficiency than a control method considering further system parameters. The FOC therefore also measures the three phase currents (which change with the motor position) and uses a vector transform (Clarke and Fujitsu Microelectronics Europe GmbH - 7 - MCU-AN-300018-E-V10

Chapter 3 Encoder drive for BLDC motors Park transforms) to project them into two currents, which are constant as long as the system is in a stationary state. One current represents the field amount in direction of the rotor axis (Id), the other one represents the orthogonal, torque-generating component (Iq). These two currents now can be controlled with separate, conventional control loops, since they appear as relatively slowly changing DC currents. The Id current is usually regulated to zero for permanent magnet motors, since the field is generated by the magnets, so the entire current is used to generate a field orthogonal to the rotor field. In field weakening mode, the Id current is set to negative values to weaken the permanent magnets field. The outputs of the control loops are then used to generate the desired stator field together with the rotor position. MCU-AN-300018-E-V10-8 - Fujitsu Microelectronics Europe GmbH

Chapter 4 Increasing the speed range for the encoder processing 4 Increasing the speed range for the encoder processing Apparently, a 500-line encoder at a speed of 3000 rpm already leads to 100.000 interrupt requests per second, if every slope is evaluated. It is obvious that this high interrupt load can cause problems concerning MCU time. Of course, the problem can be avoided if a dedicated up-/down counter is used, where the processing of the encoder signal is done in hardware and only a register has to be read to get the position data. But also without dedicated hardware, a functional work-around is possible without loosing effective resolution. As an example, the usage of a 500-line encoder on a 2-pole PMSM (Permanent Magnet Synchronous Motor) is shown. The methods described here are also used in the software example bundled with this document, and some parts are also shown in this document. The main idea is to decrease the used encoder resolution step-wise as the speed increases. Of course this implies that the rotation speed has to be measured at a sufficiently short interval. At low speed, all four slopes of every encoder cycle (not mechanical rotation) are evaluated, giving the position as exact as possible. Above a certain speed, the second channel of the encoder is de-activated (e.g. by disabling the according ICU interrupt). To keep the pulses per round constant, every slope of channel A now increments or decrements the position counter by two, depending on the direction. Since the quadrature relationship between the encoder outputs is no longer present, forward and backward movement cannot be distinguished at high speeds. But as it is very unlikely (or physically impossible) that the movement changes from fast forward to fast backward without being slow somewhere in between, this has no real impact. Also the decreased position resolution will be no problem for most applications. Normally, it will not be necessary to update the position more than once per PWM period, which is about 67us in this case. So in this example, the encoder is switched to single channel at 1000 rpm, causing the position update interval to relax from 30us to 60us. If the method described above is still not sufficient for the desired speed, the ICU connected to channel A can be configured to trigger on one slope only, again doubling the time between two interrupt requests. The encoder ISR now increments or decrements the position counter by four, depending on the direction. As long as the speed is updated fast enough, the different regions of resolution are switched seamlessly and without noticeable side effects, so the speed range can be nearly quadrupled at the same IRQ load. In this simple example, small position errors can occur when switching between the resolutions. If e.g. the position count is an odd number at the moment the routine switches to half-resolution, the next zero index signal will reset the counter from 1999 or 0001 to zero. Also, in case one encoder channel fails, the error is not automatically detected by the error counter in the encoder ISR. Fujitsu Microelectronics Europe GmbH - 9 - MCU-AN-300018-E-V10

Chapter 5 Connecting an encoder to the MotorKit-91F267-MC 5 Connecting an encoder to the MotorKit-91F267-MC The MotorKit-91F267-MC is a Starter Kit for motor control applications using the Fujitsu MB91F267N Flash microcontroller. It features all necessary connections for various system variants, and also for an optical encoder. The pin-out of the encoder input (J13) is compatible to the popular HEDL-series encoders with integrated line drivers. The pins are connected as follows: J13 pin Signal MCU input 2 VCC5 3 GND 6 A IC0 8 B IC1 10 I INT3 other n/c - 1 3 5 7 9 2 4 6 8 10 The evaluation board only uses the positive signals of the line driver output, since the cable length during evaluation is considered rather short. To make use of the differential encoder signals, additional differential receiver stages should be used. In case an encoder without integrated line driver is used, additional pull-up resistors (typically 2k7) can be mounted on the board (R103-R105). By opening JP54, JP56 and JP57 the input capture pins IC0-2 of the MCU are disconnected from the Hall sensor input (J12) and can be connected to the encoder input by closing JP60- JP62. In case additional Hall sensors of the Motor shall be used, JP54, JP56 and JP57 can be used to connect the Hall sensor input to external interrupt pins of the MCU. MCU-AN-300018-E-V10-10 - Fujitsu Microelectronics Europe GmbH

Chapter 6 Source code segments 6 Source code segments The encoder interrupt service routine (Input Capture 1 + 2) in this example looks like this: void interrupt encoder_irq(void){ // Input capture ISR for encoder handling static unsigned char last_enc_state, enc_state; static unsigned short int last_enc_event; enc_state=(pdr2>>5)&0x03; PDRG=0x02; // get the actual encoder state // set port pin PG1 to indicate encoder ISR switch(last_enc_state){ case 0: switch(enc_state){ case 1: enc_position -= ENC_COUNT_DIR; // when running at low speeds, all // pulses are evaluated to detect direction and // full accuracy case 2: enc_position += ENC_COUNT_DIR; case 3: { if (dir>0) enc_position += 2*ENC_COUNT_DIR; // at higher speeds, channel B (IC1) // can be deactivated to reduce IRQ load else enc_position -= 2*ENC_COUNT_DIR; case 0: { if (dir>0) enc_position += 4*ENC_COUNT_DIR; // at even higher speeds, channel a // can be set to falling edge only else enc_position -= 4*ENC_COUNT_DIR; default: enc_errors++; case 1: switch(enc_state){ case 3: enc_position -= ENC_COUNT_DIR; case 0: enc_position += ENC_COUNT_DIR; case 2: { if (dir>0) enc_position += 2*ENC_COUNT_DIR; else enc_position -= 2*ENC_COUNT_DIR; case 1: { if (dir>0) enc_position += 4*ENC_COUNT_DIR; else enc_position -= 4*ENC_COUNT_DIR; default: enc_errors++; case 2: switch(enc_state){ case 0: enc_position -= ENC_COUNT_DIR; case 3: enc_position += ENC_COUNT_DIR; case 1: { if (dir>0) enc_position += 2*ENC_COUNT_DIR; else enc_position -= 2*ENC_COUNT_DIR; case 2: { if (dir>0) enc_position += 4*ENC_COUNT_DIR; else enc_position -= 4*ENC_COUNT_DIR; default: enc_errors++; case 3: switch(enc_state){ case 2: enc_position -= ENC_COUNT_DIR; case 1: enc_position += ENC_COUNT_DIR; case 0: { if (dir>0) enc_position += 2*ENC_COUNT_DIR; else enc_position -= 2*ENC_COUNT_DIR; // to further reduce the irq load // only effective without resolution switching Fujitsu Microelectronics Europe GmbH - 11 - MCU-AN-300018-E-V10

Chapter 6 Source code segments case 3: { if (dir>0) enc_position += 4*ENC_COUNT_DIR; else enc_position -= 4*ENC_COUNT_DIR; default: enc_errors++; default: enc_errors++; // keep postion in range (for 500 line encoder x4): if (enc_position>=65000) enc_position += ENCODER_PULSES; // correct underflow else if (enc_position>=encoder_pulses) enc_position -= ENCODER_PULSES; //correct overflow last_enc_state=enc_state; if ((PICSL01_ICP0==1)&&(PICSH01_IEI0==0)) { // If ICU0 falling edge was the interrupt // cause (channel A) enc_time = IPCP0-last_enc_event; // calculate the time between the last event // and the actual one last_enc_event = IPCP0; // store timestamp of actual event PDRG=0x00; PICSL01 &=0x3F; // clear port pin indicating encoder ISR // clear interrupt flags void interrupt ext3_zero_irq(void){ enc_position=0; turns++; // Encoder zero index signal // Reset position counter // Count up revolution counter EIRR0_ER3=0; // clear interrupt flags The following code re-configures the input captures depending on the speed and should be called frequently, so it can be placed e.g. in the main loop: if (frt_rpm<encoder_x4_max_rpm) {PICSL01_ICE1=1; PDR0_P00=1; PDR0_P01=1; // full encoder resolution at low speed else {PICSL01_ICE1=0;PDR0_P01=0; // half resolution at higher speed (disable IC1) if (frt_rpm<encoder_x2_max_rpm) {PICSL01_EG00=1; PDR0_P00=1; else {PICSL01_EG00=0; PDR0_P00=0; // Only one slope of channel a at high speed A complete software example using these routines is bundled with this document. It also uses the Hall sensors of the motors (if connected) to set a start-up position. As soon as the first zero index of the encoder is detected, the absolute position is corrected. Port Pin PG1 is set to 'high' during every encoder processing interrupt. LED0 and 1 on the MotorKit-91F267-MC also show the actual encoder resolution used (Both on: x4, only LED0: x2, both off: x1). The example software calculates the sine lookup table (with 3 rd harmonics injection) at startup and stores it in the RAM of the MCU, so also a normal sine table can be calculated. No size optimizations are made, which can be done using the properties of the trigonometric functions. The memory usage of the sine table could be reduced e.g. by storing only the values from 0-90, from which all other values can be calculated by appropriate mirroring. MCU-AN-300018-E-V10-12 - Fujitsu Microelectronics Europe GmbH

Chapter 7 Appendix 7 Appendix 7.1 Figures Figure 1: Incremental encoder signal... 6 Figure 2: Pure sine voltages Figure 3: Sine + 3rd harmonics... 7 7.2 Related Documents MB91265 Series Hardware Manual: - hm91265-cm71-10130-2e.pdf Application note on rotary encoders: - mcu-an-390055-e-v12-rotary_encoder.pdf 7.3 Related software examples - motorkit-91f267-mc_encoder_bldc-v10 The newest version of these software examples can be found on the web at: http://mcu.emea.fujitsu.com/ Additional information to other Fujitsu products can be found at: http://www.fujitsu.com/emea/ Fujitsu Microelectronics Europe GmbH - 13 - MCU-AN-300018-E-V10