'Adams Motor Control Program
If you have entered this web page from my home site you already know what my program is intended for. But you could have found my site surfing the net so it would be useful to visit my home page http://geocities.com/freersn/.  It is possible to modify the program so that it will be able to control the motor speed and send this parameter to a computer via a COM port. This can be done by MAX232 microcircuit as described in the file DN_026.pdf placed on the website www.sparkfun.com. I have a tested circuit so you can consult me as to a simple RS232 interface.
The commutation of the stator current by the hall sensors' output doesn't seem to be the best solution due to the possible deviation of magnets' characteristics. This causes bad coincidence of the stator current triggering points.To improve the control circuit it is sensible to use optical switching. My control circuit with an opto switch is capable of working but it still needs arrangement to estimate its advantage. If anybody feels like replicating my control circuit I can send a Hex - file via e-mail or place it on my web site.
'--------------------------------------------------------------------------------------------------------
'The motor is controlled by the 1-st Hall sensor in the course of starting.
'This allows to increase the driving torque. When starting is over both sensors
'operate the stator current reducing pulse width and power consumption.
'---------------------------------------------------------------------------------------------------------
$regfile = "2313def.dat"                     'chip type
$crystal = 8000000                             'clock frequency
Dim W1 As Word
Dim W2 As Byte
Dim Cm As Byte
Dim Lg As Byte
Dim Lt As Byte
Const Cnx = 3                                     'Number of timer's cycles during starting
Config Timer1 = Timer , Prescale = 1024                    'the frequency is divided by 1024
Enable Timer1                                   'enable the timer1 interrupt
Config Timer0 = Timer , Prescale = 1024 '
Enable Timer0
Enable Interrupts                              'allow interrupts to occur
Config Portb = Output                       'assign PortB and PortD pins
Config Pind.1 = Input
Config Pind.2 = Input
Config Pind.3 = Output
Ddrd.1 = 0                                           'Set Pd1 as input
Ddrd.2 = 0                                           'Set Pd2 as output
Portd.1 = 1
Portd.2 = 1
Start Timer1
Cm = 1                                                'assign the initial value
Do
W1 = Timer1
If  W1 < 65530 Then
    Lg = 1
    If Pind.1 = 1 And Cm < Cnx Then        'Check Hall Sensor 1 signal
         Portb.2 = 0                                          ' LED is turned on
         Portd.3 = 0                                          ' Close Q1
           Else
               Portb.2 = 1                                    'LED is turned off
               Portd.3 = 1                                   ' Open Q1
          End If '
    Else
           Portb.2 = 1                                       'LED is turned off
           If Lg = 1 Then
           Cm = Cm + 1
            Lg = 2
            If Cm = Cnx Then Stop Timer1   ' Stop Timer1 after starting
    End If
If Pind.1 = 1 And Pind.2 = 0 Then          'Check Hall Sensors 1 and 2 output signal
    Portb.2 = 1                                            'LED is turned off
    Portd.3 = 0                                            ' Close Q1
    Lt = 1
      Else
         Portd.3 = 1                                       ' Open Q1
           If Lt = 1 Then                                 'check starting condition
                Start Timer0
                Lt = 2
          End If
         W2 = Timer0
             If W2 >10 And W2 < 20 Then         'opto thyristor pulse width
                  Portb.3 = 1                             'opto thyristor pulse front
                     Else
                        Portb.3 = 1                        'opto thyristor pulse cut-off
            End If
          End If
End If
Loop
Last modified 08/10/2005
Hosted by www.Geocities.ws

1