DAS
3.1.6 - 18/09/2017
|
AMSs Functions used in DAS Program. More...
Go to the source code of this file.
Data Structures | |
struct | DXL_par |
DXL structure. Structure for the serial communication with the AMS adapter. More... | |
Typedefs | |
typedef struct DXL_par | DXL_par |
DXL structure. Structure for the serial communication with the AMS adapter. More... | |
Functions | |
void | AMS_assadd (int w) |
Assign AMS address Procedure for assigment of the AMS address. More... | |
int | AMS_AzzeraCoord (int id, int mtr) |
Set to zero the number of steps on the selected motor Set to zero the number of steps on the selected motor. More... | |
int | AMS_chkbitsts (int id, int bitn) |
check bit status Procedure for the determination of the bit number status. More... | |
void | AMS_Default (int id) |
Set default values to AMS parameters Procedure for setting the default values of power.speed, stepping and slope to the selected AMS adapter. More... | |
int | AMS_dirfin (int id, int dira, int dirb) |
Set Final Directions . More... | |
int | AMS_Divisore (int id, unsigned long par1, unsigned long par2) |
int | AMS_DoPos (int id, int dira, int dirb, unsigned long stepa, unsigned long stepb) |
Execute Positioning Execute Stepper positioning. Make all the control on the status of the selected motor. More... | |
int | AMS_firmrev (int id) |
Firmware Revision Number . More... | |
int | AMS_Home (int id, int mota, int motb) |
Home position for the selected motor the home position is reached with the standard parameters (1KHz, 2000 s/r) More... | |
int | AMS_HomeDefault (int id, int mota, int motb) |
int | AMS_MotorOn_Off (int id, int mtr1, int mtr2) |
Motor ON-OFF. Switch On-Off the selected motor of the selected AMS. More... | |
int | AMS_Power (int id, int powa, int powb) |
Set Power for AMS Procedure for setting the user choosed power to the selected AMS adapter. More... | |
void | AMS_PWM (int id, int on, int off) |
set the on/off time on the PWM set the on/off time on the PWM. More... | |
void | AMS_PWM_OFF (int id) |
void | AMS_PWM_Zero (int mod) |
unsigned long | AMS_ReadStep (int id, int motor) |
read performed steps Procedure for the determination of the number of steps executed. More... | |
int | AMS_sendstep (int id, int dira, int dirb, unsigned long stepa, unsigned long stepb) |
Send steps Procedure for sending steps to the Stepper Motor. More... | |
int | AMS_Slope (int id, int slopea, int slopeb) |
Set slope to the Stepper motors Procedure for setting the slope fot the Stepper Motors. More... | |
int | AMS_Speed (int id, int speeda, int speedb) |
Set speed to the Stepper motors Procedure for setting speed for the Stepper Motors. More... | |
int | AMS_Step (int id, int stepa, int stepb) |
Set stepping for the Stepper motors Procedure for setting steps for the Stepper Motors. More... | |
int | AMS_TestHome (int id, int par1) |
verify if the home position has been reached More... | |
int | AMS_TestPos (int id, int motor) |
Test positioning status Procedure for testing the positioning status of the selected motor. More... | |
int | AMS_TestWork (int id, int par1) |
verify the if work position has been reached More... | |
int | AMS_TrackOff (int id, int amot, int bmot) |
tracking off Procedure for Stepper Motor tracking de-activation More... | |
int | AMS_TrackOn (int id, int adir, int bdir, unsigned long acount, unsigned long bcount) |
Activate tracking Procedure for Stepper Motor tracking activation. More... | |
int | AMS_wopto (int id, unsigned int w) |
write the value on the optoinsulated port write the value on the optoinsulated port. More... | |
int | DXL_Close (void) |
Close COM. More... | |
int | DXL_Open (int addr, int com, int baud) |
Open COM. More... | |
int | DXL_RxStr (char *rx, int *len) |
receive string from a serial port More... | |
void | DXL_TxStr (char *tx, int len) |
send string to a serial port More... | |
DXL structure. Structure for the serial communication with the AMS adapter.
void AMS_assadd | ( | int | w | ) |
Assign AMS address
Procedure for assigment of the AMS address.
w | = AMS ADDRESS |
Definition at line 25 of file Dxl.c.
References DXL_par::add.
Referenced by AMS_AzzeraCoord(), AMS_chkbitsts(), AMS_chkbitsts_old(), AMS_Default(), AMS_dirfin(), AMS_Divisore(), AMS_DoPos(), AMS_ESlope(), AMS_firmrev(), AMS_Home(), AMS_HomeDefault(), AMS_MotorOn_Off(), AMS_Power(), AMS_Proxy(), AMS_PWM(), AMS_PWM_OFF(), AMS_ReadAD(), AMS_ReadStep(), AMS_sendstep(), AMS_SetPolarity(), AMS_Slope(), AMS_Speed(), AMS_Step(), AMS_TestHome(), AMS_TestPos(), AMS_TestWork(), AMS_TrackOff(), AMS_TrackOn(), and AMS_wopto().
int AMS_AzzeraCoord | ( | int | id, |
int | mtr | ||
) |
Set to zero the number of steps on the selected motor
Set to zero the number of steps on the selected motor.
id | = AMS ADDRESS |
mtr | = 0 –> A Motor, = 1 –> B Motor |
Definition at line 439 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by DB_ToolsKeyB_CB(), HomeAzimFast(), HomeFiltersFast(), HomeGratingFast(), HomeMirror(), HomeNDFiltersFast(), HomeZenithFast(), and Task_HomeGrat().
int AMS_chkbitsts | ( | int | id, |
int | bitn | ||
) |
check bit status
Procedure for the determination of the bit number status.
id | = AMS ADDRESS |
bitn | BIT NUMBER –> 0 = LSB, 7 = MSB |
Definition at line 192 of file Dxl.c.
References AMS_assadd(), DXL_par::bufrx, DXL_par::buftx, DXL_HexBin(), DXL_RxStr(), DXL_TxStr(), Message(), and STS0LEN.
Referenced by HomeAzimFast(), HomeFiltersFast(), HomeNDFiltersFast(), HomeTrack(), HomeZenithFast(), ReadInputCB(), Task_AMSH(), and Task_HomeGrat().
void AMS_Default | ( | int | id | ) |
Set default values to AMS parameters
Procedure for setting the default values of power.speed, stepping and slope to the selected AMS adapter.
Definition at line 174 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_RxStr(), and DXL_TxStr().
Referenced by DB_Home_CB(), E_Home_SM4(), E_Home_SM6(), HomeAzimFast(), HomeFiltersFast(), HomeGratingFast(), HomeMirror(), HomeNDFiltersFast(), and HomeZenithFast().
int AMS_dirfin | ( | int | id, |
int | dira, | ||
int | dirb | ||
) |
Set Final Directions
.
id | = AMS ADDRESS |
dira | = 0/1 for Motor A |
dirb | = 0/1 for Motor B |
Definition at line 457 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by DB_Home_CB(), DB_InitMotor(), HomeAzimFast(), HomeFiltersFast(), HomeGratingFast(), HomeMirror(), HomeNDFiltersFast(), and HomeZenithFast().
int AMS_Divisore | ( | int | id, |
unsigned long | par1, | ||
unsigned long | par2 | ||
) |
Definition at line 946 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by HomeAzimFast(), HomeMirror(), and HomeTrack().
int AMS_DoPos | ( | int | id, |
int | dira, | ||
int | dirb, | ||
unsigned long | stepa, | ||
unsigned long | stepb | ||
) |
Execute Positioning Execute Stepper positioning. Make all the control on the status of the selected motor.
id | = AMS ADDRESS |
dira | = 0/1 for Motor A |
dirb | = 0/1 for Motor B |
stepa | = steps for Motor A |
stepb | = steps for Motor B |
Definition at line 644 of file Dxl.c.
References controlpanel::Albl_LS, AMS_assadd(), AMS_ReadStep(), AMS_sendstep(), AMS_TestPos(), optionini::amsprogbar, gui::ContrPanel, D_Positioning(), D_VRange(), DBDEMO, das::DOption, flag::exemode, das::Flag, FlgSM_Stop, das::Gui, stepm::postime, stepm::SM_A, stepm::SM_B, stepm::speed_Hz, Status(), das::StepM, TESTSZAMODE, and writelogmotor().
Referenced by DB_StepMotor(), DE_StepMotor(), HomeGratingFast(), and HomeMirror().
int AMS_firmrev | ( | int | id | ) |
Firmware Revision Number
.
id | = AMS ADDRESS |
Definition at line 475 of file Dxl.c.
References AMS_assadd(), DXL_par::bufrx, DXL_RxStr(), DXL_TxStr(), and STS0LEN.
Referenced by DB_InitAMS().
int AMS_Home | ( | int | id, |
int | mota, | ||
int | motb | ||
) |
Home position for the selected motor
the home position is reached with the standard parameters (1KHz, 2000 s/r)
Home position for the selected motor
the home position is reached with the actual parameters for the motors.
id | = AMS ADDRESS |
mota | Motor A |
motb | Motor B |
Definition at line 549 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by HomeGratingFast(), HomeMirror(), and HomeZenithFast().
int AMS_HomeDefault | ( | int | id, |
int | mota, | ||
int | motb | ||
) |
Definition at line 567 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by HomeGratingFast(), HomeMirror(), and HomeZenithFast().
int AMS_MotorOn_Off | ( | int | id, |
int | mtr1, | ||
int | mtr2 | ||
) |
Motor ON-OFF.
Switch On-Off the selected motor of the selected AMS.
addr | = AMS address:
|
mtr1 |
|
mtr2 |
|
Definition at line 930 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by E_Home_SM3(), and Task_HomeGrat().
int AMS_Power | ( | int | id, |
int | powa, | ||
int | powb | ||
) |
Set Power for AMS
Procedure for setting the user choosed power to the selected AMS adapter.
id | AMS ADDRESS:
|
powa | power assigned to motor A (Range: 00h-4Ch, Bit weight = 0.02A, Default = 19h = 0.5A) |
powb | power assigned to motor B (Range: 00h-4Ch, Bit weight = 0.02A, Default = 19h = 0.5A) |
Definition at line 326 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, delay(), DXL_RxStr(), and DXL_TxStr().
Referenced by DB_InitAMS().
void AMS_PWM | ( | int | id, |
int | on, | ||
int | off | ||
) |
set the on/off time on the PWM
set the on/off time on the PWM.
id | = AMS ADDRESS |
on | = on time |
off | = off time |
Definition at line 492 of file Dxl.c.
References ACKLEN, DXL_par::add, AMS_assadd(), DXL_par::buftx, delay(), DXL_RxStr(), and DXL_TxStr().
Referenced by ADTesterCB(), OMU_AssignPow(), and ShutCB().
void AMS_PWM_OFF | ( | int | id | ) |
Definition at line 584 of file Dxl.c.
References ACKLEN, DXL_par::add, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by OMU_DoPeltPow().
void AMS_PWM_Zero | ( | int | mod | ) |
Definition at line 2570 of file Spat_Device.c.
References AMS2, AMS_wopto(), ChkDigIO(), delay(), stepm::OOP, and das::StepM.
Referenced by OMU_DoPeltPow().
unsigned long AMS_ReadStep | ( | int | id, |
int | motor | ||
) |
read performed steps
Procedure for the determination of the number of steps executed.
id | = AMS ADDRESS |
motor | = 0 –> A Motor, = 1 –> B Motor |
Definition at line 60 of file Dxl.c.
References AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by AMS_DoPos(), AMS_TestPos(), DB_ToolsKeyB_CB(), and Task_HomeGrat().
int AMS_sendstep | ( | int | id, |
int | dira, | ||
int | dirb, | ||
unsigned long | stepa, | ||
unsigned long | stepb | ||
) |
Send steps Procedure for sending steps to the Stepper Motor.
id | = AMS ADDRESS |
dira | = 0/1 for Motor A |
dirb | = 0/1 for Motor B |
stepa | = steps for Motor A |
stepb | = steps for Motor B |
Definition at line 513 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by AMS_DoPos(), SD_PosAADev(), SD_Position(), and SD_PosOMUDev().
int AMS_Slope | ( | int | id, |
int | slopea, | ||
int | slopeb | ||
) |
Set slope to the Stepper motors Procedure for setting the slope fot the Stepper Motors.
id | = AMS ADDRESS |
slopea | slope for motor A |
slopeb | slope for motor B |
Definition at line 368 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by DB_InitAMS().
int AMS_Speed | ( | int | id, |
int | speeda, | ||
int | speedb | ||
) |
Set speed to the Stepper motors Procedure for setting speed for the Stepper Motors.
id | = AMS ADDRESS |
speeda | speed for motor A |
speedb | speed for motor B |
Definition at line 386 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by DB_InitAMS().
int AMS_Step | ( | int | id, |
int | stepa, | ||
int | stepb | ||
) |
Set stepping for the Stepper motors Procedure for setting steps for the Stepper Motors.
id | = AMS ADDRESS |
stepa | stepping value for motor A |
stepb | stepping value for motor B |
Definition at line 349 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by DB_InitAMS().
int AMS_TestHome | ( | int | id, |
int | par1 | ||
) |
verify if the home position has been reached
verify the if home position has been reached
id | = AMS ADDRESS |
par1 | 0 = Motor A; 1 = Motor B |
id | = AMS ADDRESS |
par1 | 0 = Motor A; 1 = Motor B |
Definition at line 1042 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::bufrx, DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by D_Homing().
int AMS_TestPos | ( | int | id, |
int | motor | ||
) |
Test positioning status
Procedure for testing the positioning status of the selected motor.
id | = AMS ADDRESS |
motor | = 0 –> A Motor, = 1 –> B Motor |
Definition at line 31 of file Dxl.c.
References AMS_assadd(), AMS_ReadStep(), DXL_par::bufrx, DXL_par::buftx, DXL_RxStr(), DXL_TxStr(), MLoopWhileEvents(), and STS0LEN.
Referenced by AMS_DoPos().
int AMS_TestWork | ( | int | id, |
int | par1 | ||
) |
verify the if work position has been reached
id | = AMS ADDRESS |
par1 | 0 = Motor A; 1 = Motor B |
Definition at line 1064 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
int AMS_TrackOff | ( | int | id, |
int | amot, | ||
int | bmot | ||
) |
tracking off Procedure for Stepper Motor tracking de-activation
id | = AMS ADDRESS |
amot | = 1 –> Execute operation on A motor, = 0 –> No operation on A Motor |
bmot | = 1 –> Execute operation on B motor, = 0 –> No operation on B Motor |
Definition at line 422 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by HomeAzimFast(), HomeFiltersFast(), HomeNDFiltersFast(), HomeTrack(), and Task_AMSH().
int AMS_TrackOn | ( | int | id, |
int | adir, | ||
int | bdir, | ||
unsigned long | acount, | ||
unsigned long | bcount | ||
) |
Activate tracking Procedure for Stepper Motor tracking activation.
id | = AMS ADDRESS |
adir | direction of motor A |
bdir | direction of motor B |
acount | COUNT = 10E6/F with F = 200 / StepFrac * (rpm) / 60 for motor A |
bcount | COUNT = 10E6/F with F = 200 / StepFrac * (rpm) / 60 for motor B |
Definition at line 404 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by HomeAzimFast(), HomeFiltersFast(), HomeNDFiltersFast(), and HomeTrack().
int AMS_wopto | ( | int | id, |
unsigned int | w | ||
) |
write the value on the optoinsulated port
write the value on the optoinsulated port.
id | = AMS ADDRESS |
w | = number of bit to be setted (0-7) |
Definition at line 911 of file Dxl.c.
References ACKLEN, AMS_assadd(), DXL_par::buftx, DXL_RxStr(), and DXL_TxStr().
Referenced by AMS_PWM_Zero(), ExtLamp(), ExtShutt(), FANECU(), FANPeltier(), HgLamp(), HiresPS(), OOP_CB(), Peltier(), PeltierPS(), QjLamp(), and SD_FNTorqueM().
int DXL_Close | ( | void | ) |
Close COM.
Definition at line 1258 of file Dxl.c.
References DXL_par::com, SioDone(), and SioReset().
Referenced by DB_CloseCOM().
int DXL_Open | ( | int | addr, |
int | com, | ||
int | baud | ||
) |
Open COM.
addr | 0 |
com | =
|
baud | =
|
Definition at line 1243 of file Dxl.c.
References DXL_par::add, Baud19200, DXL_par::com, NoParity, OneStopBit, SioBaud(), SioParms(), SioReset(), DXL_par::speed, and WordLength8.
Referenced by DB_InitCOM().
int DXL_RxStr | ( | char * | rx, |
int * | len | ||
) |
receive string from a serial port
rx | received string |
*len | num of chars to be received |
Definition at line 1187 of file Dxl.c.
References DXL_par::add, DXL_par::bufrx, DXL_par::com, DWORD, DXL_HexBin(), p, SioGets(), SioRxQue(), and st.
Referenced by AMS_AzzeraCoord(), AMS_chkbitsts(), AMS_chkbitsts_old(), AMS_Default(), AMS_dirfin(), AMS_Divisore(), AMS_ESlope(), AMS_firmrev(), AMS_Home(), AMS_HomeDefault(), AMS_MotorOn_Off(), AMS_Power(), AMS_Proxy(), AMS_PWM(), AMS_PWM_OFF(), AMS_ReadAD(), AMS_ReadStep(), AMS_sendstep(), AMS_SetPolarity(), AMS_Slope(), AMS_Speed(), AMS_Step(), AMS_TestHome(), AMS_TestPos(), AMS_TestWork(), AMS_TrackOff(), AMS_TrackOn(), AMS_wopto(), DB_InitAMS(), DB_StsMotor(), FPGACB(), HomeFiltersFast(), and HomeNDFiltersFast().
void DXL_TxStr | ( | char * | tx, |
int | len | ||
) |
send string to a serial port
*tx | sent string |
len | num of chars to be sent |
Definition at line 1153 of file Dxl.c.
References DXL_par::add, ch, DXL_ByteHex(), and DXL_TxByte().
Referenced by AMS_AzzeraCoord(), AMS_chkbitsts(), AMS_chkbitsts_old(), AMS_Default(), AMS_dirfin(), AMS_Divisore(), AMS_ESlope(), AMS_firmrev(), AMS_Home(), AMS_HomeDefault(), AMS_MotorOn_Off(), AMS_Power(), AMS_Proxy(), AMS_PWM(), AMS_PWM_OFF(), AMS_ReadAD(), AMS_ReadStep(), AMS_sendstep(), AMS_SetPolarity(), AMS_Slope(), AMS_Speed(), AMS_Step(), AMS_TestHome(), AMS_TestPos(), AMS_TestWork(), AMS_TrackOff(), AMS_TrackOn(), AMS_wopto(), DB_InitAMS(), DB_StsMotor(), FPGACB(), HomeFiltersFast(), and HomeNDFiltersFast().