==========================================================================
               Simple sine BLDC Project for MB91265 Series
==========================================================================
                   Fujitsu Microelectronics Europe GmbH                       
                     Pittlerstrasse 47, 63225 Langen                    
                    Tel.: ++49 (6103) 690-0, Fax -122                     
                                                            
 The following  software  is for  demonstration  purposes only.  It is not
 fully  tested, nor validated  in order  to fullfill  its task  under  all
 circumstances.  Therefore,  this software or  any part of it must only be
 used in an evaluation laboratory environment.                        
 This software is subject to the rules of our standard DISCLAIMER, that is
 delivered with our  SW-tools on the Fujitsu Microcontrollers CD 
 (V3.0 or higher "\START.HTM") or on our Internet Page:
 http://www.emea.fujitsu.com  
==========================================================================

History
Date      Ver     Author  Softune     Description
05.03.07  1.0     CHa     V60L05      initial version based on template 1.4

==========================================================================

This is a project template for the MB91265 Series. It includes some basic 
settings for e.g. Linker, C-Compiler which must be checked and modified in 
detail, corresponding to the user application.

This is a simple application example to run two BLDC motors with hall sensors
using the MB91F267. The example runs on the MotorKit-MB91F267-MC with an
additional power stage for the second motor, but can also be modified for
other hardware.

The first motor is driven open loop with sinusoidal commutation, while the
second motor uses block commutation.

The motor will sometimes judder at very low speeds, especially during startup
or with high loads. This is to a certain grade unevitable, since the position
cannot be actualized at sufficiant rate.
If the motor does not accelerate correctly at all, try to adapt the
lookup tables in the globals.h file:
First, the hall_to_sector[] table has to be modified so that it returns
subsequent sector numbers (1..6) during rotation. Then, if the motor still
does not start up correctly, try rotating the sector_to_s_angle[] lookup table:

{0,1920,5760,9600,13440,17280,21120,0} -> {0,5760,9600,13440,17280,21120,1920,0}
...
...

Have a look at the globals.h file for further configurations.

The following controls are implemented:

T1: Stop or run forward
T2: Stop or run backward
T3: Show status information on UART
T4: Start or stop the second motor

P1: Set desired open loop speed (pwm duty cycle) of first motor
P2: Set desired open loop speed (pwm duty cycle) of second motor


Motor 1 Connections:

P30/RTO0 = 1H  Motor 1 Phase 1
P31/RTO1 = 1L
P32/RTO2 = 2H  Motor 2 Phase 2
P33/RTO3 = 2L
P34/RTO4 = 3H  Motor 3 Phase 3
P35/RTO5 = 3L

P25/IC0 = Hall Sensor A
P26/IC1 = Hall Sensor B
P20/IC2 = Hall Sensor C

Motor 2 Connections:

P00 = 1H
P01 = 1L
P02 = 2H
P03 = 2L
P04 = 3H
P05 = 3L

Ext. Int 0 = Hall Sensor A
Ext. Int 1 = Hall Sensor B
Ext. Int 2 = Hall Sensor C

Ext. Int 3 (Pin 61) must be connected to P37/PPG4 (Pin 49)
