test 03/05/2019

Dependencies:   mbed QEI StepperTB TEST001

Get_Control.h

Committer:
csggreen
Date:
2019-03-05
Revision:
1:d7aa1591fbc2
Parent:
0:d97ede1e24bc

File content as of revision 1:d7aa1591fbc2:

#include "mbed.h"
#include "AX12.h"
#include "StepperTB.h"
#include "QEI.h"

Serial pc(PA_9, PB_6);
AX12 myax12 (PA_11, PA_12, 1);

//motor set 1
DigitalOut ENA_1(PC_8);
PwmOut DIR_1(PC_6);
DigitalOut PUL_1(PC_5);

//motor set 2
DigitalOut ENA_2(PB_2);
PwmOut DIR_2(PB_1);
DigitalOut PUL_2(PB_15);

//motor set 3
DigitalOut ENA_3(PC_14);
PwmOut DIR_3(PC_13);
DigitalOut PUL_3(PC_4);

//Buzzer
DigitalOut Buzzer(PB_12);

//Vacum
DigitalOut VACUM(PA_3);

//Limit Switch
DigitalOut LSwitch_1(PA_2);
DigitalOut LSwitch_2(PA_10);
DigitalOut LSwitch_3(PB_3);
DigitalOut LSwitch_4(PB_4);
DigitalOut LSwitch_5(PB_5);
DigitalOut LSwitch_6(PB_10);


//Encoder interrupt
//QEI EncoderCH_1 (PC_0, PC_1, NC, 624);
//QEI EncoderCH_2 (PB_0, PA_4, NC, 624);
//QEI EncoderCH_3 (PA_1, PA_0, NC, 624);

////////////////////////////////////////////////////////
////////////        parameter_drive       /////////////
////////////////////////////////////////////////////////
long time_corexy = 0;
long long time_z=0;
long counter1=0;      /// counter of encoder in each motor
long counter2=0;
long counter3=0;
long CS1 =0; 
long CS2 =0;  

char direct_motor1=0; /// direct_motor=0 ---> count ++ ,direct_motor=1 ---> count --
char direct_motor2=0;
char direct_motor3=0;
    
int drive_axis = 0 ; /// drive_axis = 0 --> drive motor1 joint 1
                     /// drive_axis = 1 --> drive motor2 joint 2
                     /// drive_axis = 2 --> drive motor3 joint 3


float u_j1,u_j2,u_j3 ;
/////////////////                   /////////////////
/////////////////    set_ZERO       /////////////////
/////////////////                   /////////////////
void setzero_posi(){
    }
    
/////////////////                  /////////////////
/////////////////    drive_motor   /////////////////
/////////////////                  /////////////////
void drive_motor_1(long u_j1){
    }
void drive_motor_2(long u_j2){
    }
void drive_motor_3(long u_j3){
    }