'*************************************************************************
'*                        <3-Phase motor controller>                     *
'*                                    by                                 *
'*                          Dr.Godfried-Willem RAES                      *
'*                        Stamp2 Hardware version 1.0                    *
'*                        Filename : <3Phase400Hz.bs2>                   *
'*                             Code version 1.0                          *
'*************************************************************************
' 15.06.1998: designed for airplane compressor motor speed control.
'             speed should vary -20% to + 30%.
'             With no data applied, the generated three phase voltage
'             should be 400Hz.
' 16.07.2001: reconsidered.
' 18.07.2001: Now runs under NT with new Parallax editor.
'             Version to drive our airplane compressor motor on 400Hz 3-phase
'             Drives loudspeaker output line transformers connected in triangle
'             to accomodate the 3 wire connection on the motor.
'             This version functions as a 3-phase 390Hz generator.
'             The BS2 is simply not fast enough to be interactive! 

' DECLARATIONS:
Centrobyte VAR  byte     ' incoming byte, from pp board


' INITIALISATION:
                    ' parallel input bits 0 to 7
                    ' these bits are mapped on midi notes 0-7
                    ' make this byte an input:
DIRL = 0
                    ' pins 8 to 11 are not used. We configure
                    ' them as outputs:
                    ' pin 8 gets pulsed and let the user display the frequency generated,
DIRC = $F
              'DIR12 = 1 :' phase U output
              'DIR13 = 1 :' phase V output
              'DIR14 = 1 :' phase W output
              'DIR15 = 1 :' not used bit
              ' these pins steer the gates of 3 logic level 15Amps power mosfets. 
DIRD = $F
LOW 12
LOW 13
LOW 14

' Initialisation of variables:

Centrobyte = INL    :' low byte is incoming info


' START OF RUN-CODE:*****************************************************
Begin:
     'Centrobyte = INL
     Pulsout 8
     OUTD = $5                   ' 60 graden	0101
     Centrobyte = INL
     OUTD = $4                   ' 120 graden   0100
     Centrobyte = INL
     OUTD = $6                   ' 180 graden   0110
     Centrobyte = INL
     OUTD = $2                   ' 240 graden   0010
     Centrobyte = INL
     OUTD = $3                   ' 300 graden   0011
     Centrobyte = INL
     OUTD = $1                   ' 360 graden   0001
Goto Begin


END
