Ilsoe Peter / motorControl

Dependents:   HIDTympDeviceWithPIDController

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers A4980ControlRegi.h Source File

A4980ControlRegi.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------
00002 *                   COPYRIGHT (C) 2010.
00003 *          GN Otometrics. All rights reserved.
00004 *-----------------------------------------------------------
00005 *            P R O P R I E T A R Y   R I G H T S
00006 * This document must not be used, nor copied in any form or
00007 * handed over to third party, without prior written
00008 * permission from GN Otometrics.
00009 *-----------------------------------------------------------
00010 *
00011 * This source file is part of the 1082 Turtle project.
00012 *
00013 * P4 Info: (P4-filetype must be "ktext" for these to work!)
00014 * Last edit by: $Author:$
00015 * Date:         $DateTime:$
00016 * Filename:     $File:$
00017 * Revision:     $Revision:$
00018 *
00019 * File Info:
00020 * Original author: peilni
00021 * Creation date:   Nov 19, 2013
00022 *
00023 * Doxygen Info: *//*!
00024 * @file
00025 * @brief Blah blah blah.
00026 *
00027 * @htmlonly
00028 * @endhtmlonly
00029 *
00030 * Blah blah
00031 */
00032 #ifndef A4980CONTROLREGI_H_
00033 #define A4980CONTROLREGI_H_
00034 #include <stdint.h>
00035 
00036 /*
00037  * (*) are default
00038  */
00039 typedef union
00040 {
00041     uint16_t I;
00042 
00043     struct
00044     {
00045         uint16_t pwm              : 1;    // bit0 PWM configuration *0=Fixed off-time, 1=Fixed frequency
00046         uint16_t tofFrq           : 3;    // bit3-1 Off time (only valid when PWM bit = 0).Replaces FRQ bits(Assumes 4-MHz clock) 000=20us, 001=24us, 010=28us, 011=32us, 100=36us, 101=40us, *110=44us, 111=48us//        Frequency )(only valid when PWM bit = 1)Replace TOF bits(Assumes 4-MHz clock) 000=24us/41.7kHz, 001=32us/31.3kHz, 010=40us/25kHz, 011=46us/21.7kHz, 100=52us/19.2kHz 101=56us/17.9kHz, *110=60us/16.7kHz, 111=64us/15.6kHz
00047         uint16_t tbk              : 2;    // bit5-4 Blank Time (Assumes 4-MHz clock) 00=1us, *01=1.5us, 10=2.5us, 11=3.5us
00048         uint16_t pfd              : 3;    // bit8-6 Fast decay time for mixed decay. Assumes 4-MHz clock 000=2us, 001=3us, 010=4us, 011=6us, 100=8us, 101=10us, 110=14us, 111=20us
00049         uint16_t mx               : 2;    // bit10-9. Max phase current as a percentage of I(SMAX) 00=25% 01=50% 10=75% *11=100%
00050         uint16_t ms               : 2;    // bit12-11. Microstep mode for external STEP input control *00=Full Step 01=Half Step 10=Quarter Step 11=Sixteenth Step
00051         uint16_t syr              : 1;    // bit13. Synchronous rectification 0=Diode recirculation *1=Synchronous
00052         uint16_t addr             : 2;    // bit15-14 Address config0 = 0b00
00053 
00054     } B;
00055 } t_config_control_regi_0;
00056 
00057 /*
00058  * (*) are default
00059  */
00060 typedef union
00061 {
00062     uint16_t I;
00063 
00064     struct
00065     {
00066         uint16_t diag             : 2;    // bit1-0 Selects signal routed to DIAG output *00=Fault-low true, 01=ST-low true, 10=PWN-on Phase A, 11=Temperature
00067         uint16_t cd               : 4;    // bit5-2 PWM count difference for ST detection default to 8
00068         uint16_t notInUse         : 5;    // bit10-6 Not in use value = 0
00069         uint16_t tsc              : 2;    // bit12-11 Overcurrent fault delay(Assumes 4-MHz clock) 00=0.5us, 01=1us, *10=2us, 11=3us
00070         uint16_t osc              : 1;    // bit13 Selects clock source *0=internal, 1=external
00071         uint16_t addr             : 2;    // bit15-14 Address config0 = 0b01
00072 
00073     } B;
00074 }t_config_control_regi_1;
00075 
00076 /*
00077  * (*) are default
00078  */
00079 typedef union
00080 {
00081     uint16_t I;
00082 
00083     struct
00084     {
00085         uint16_t sc               : 6;    // bit5-0 Step change number 2’s complement format. Positive value increases Step Angle Number. Negative value decreases Step Angle Number
00086         uint16_t dcy              : 2;    // bit7-6 Decay mode selection 00=Slow, *01=Mixed-PFD fixed, 10=Mixed-PFD auto, 11=Fast
00087         uint16_t brk              : 1;    // bit8 Brake enable *0=Normal operation 1=Brake active
00088         uint16_t slew             : 1;    // bit9 Slew rate control 0=Disable *1=Enable
00089         uint16_t hlr              : 1;    // bit10. Selects slow decay and brake recirculation path *0=High side, 1=Low side
00090         uint16_t ol               : 2;    // bit12-11. Open load current threshold as a percentage of maximum current defined by ISMAX and MXI[1..0] 00=20%, *01=30%, 10=40%, 11=50%
00091         uint16_t en               : 1;    // bit13. Phase current enable OR with ENABLE pin *0=Output bridges disabled if ENABLE pin = 0, 1=Output bridges enabled
00092         uint16_t addr             : 2;    // bit15-14 Address run = 0b10
00093 
00094     } B;
00095 }t_run_regi;
00096 
00097 
00098 
00099 #endif /* A4980CONTROLREGI_H_ */