Driver L6470 Pentru Motoare Pas Cu Pas Electrice1 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Driver L6470 pentru motoare pas cu pas electrice

#include <AutoDriver.h>

#include <dSPINConstants.h>

AutoDriver boardA(10, 6);

byte stepMode=STEP_FS;

float stepsPerSecond=500;

byte dir=FWD;

float stepsPerSec=500;

void setup()

void configSyncPin(byte pinFunc, byte syncSteps);

void configStepMode(byte stepMode);

void setMaxSpeed(float stepsPerSecond);

void setMinSpeed(float stepsPerSecond);

void setFullSpeed(float stepsPerSecond);

void setAcc(float stepsPerSecondPerSecond);

void setDec(float stepsPerSecondPerSecond);

void setOCThreshold(byte threshold);

void setPWMFreq(int divisor, int multiplier);

void setSlewRate(int slewRate);

void setOCShutdown(int OCShutdown);

void setOscMode(int oscillatorMode);

void setVoltageComp(int vsCompMode);

void setSwitchMode(int switchMode);

void setAccKVAL(byte kvalInput);

void setDecKVAL(byte kvalInput);

void setRunKVAL(byte kvalInput);

void setHoldKVAL(byte kvalInput);

void setLoSpdOpt(boolean enable);


void resetDev();

void busyCheck();

void run(byte dir, float stepsPerSec);

void move(byte dir, unsigned long numSteps);

void softStop();

void hardStop();

void softHiZ();

void hardHiZ();

long getPos();

void resetPos();

void setMark(long newMark);

void setPos(long newPos);

void goTo(long pos);

void goToDir(byte dir, long pos);

void goHome();

void stepClock(byte dir);

void goUntil(byte action, byte dir, float stepsPerSec);

void releaseSw(byte action, byte dir);

void setParam(byte param, unsigned long value);

unsigned long getParam(byte param);

dSPINConfig();

Serial.begin(9600);

Serial.println("Dati comanda de pornire");

boardA.resetDev();

void loop()

if (Serial.available() !=0)
{

Serial.println("A primit comanda");

Serial.read();

Serial.println("Incepe deplasare inainte");

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(stepsPerSecond);

boardA.setFullSpeed(stepsPerSecond);

boardA.run(dir, stepsPerSec);

delay(1000);

void dSPINConfig(void)

boardA.configSyncPin(BUSY_PIN, 0);

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(10000);

boardA.setFullSpeed(10000);

boardA.setAcc(10000);

boardA.setDec(10000);

boardA.setSlewRate(SR_530V_us);

boardA.setOCThreshold(OC_750mA);

boardA.setPWMFreq(PWM_DIV_2, PWM_MUL_2);

boardA.setOCShutdown(OC_SD_DISABLE);

boardA.setVoltageComp(VS_COMP_DISABLE);

boardA.setSwitchMode(SW_USER);

boardA.setOscMode(INT_16MHZ_OSCOUT_16MHZ);

boardA.setAccKVAL(255);

boardA.setDecKVAL(255);

boardA.setRunKVAL(255);

boardA.setHoldKVAL(32);

}
Programul 2

#include <AutoDriver.h>

#include <dSPINConstants.h>

AutoDriver boardA(10, 6);

byte stepMode=STEP_FS;

float stepsPerSecond=200;

byte dir=FWD;

float stepsPerSec=500;

void setup()

{ void configSyncPin(byte pinFunc, byte syncSteps);

void configStepMode(byte stepMode);

void setMaxSpeed(float stepsPerSecond);

void setMinSpeed(float stepsPerSecond);

void setFullSpeed(float stepsPerSecond);

void setAcc(float stepsPerSecondPerSecond);

void setDec(float stepsPerSecondPerSecond);

void setOCThreshold(byte threshold);

void setPWMFreq(int divisor, int multiplier);

void setSlewRate(int slewRate);

void setOCShutdown(int OCShutdown);

void setOscMode(int oscillatorMode);

void setVoltageComp(int vsCompMode);

void setSwitchMode(int switchMode);

void setAccKVAL(byte kvalInput);

void setDecKVAL(byte kvalInput);

void setRunKVAL(byte kvalInput);

void setHoldKVAL(byte kvalInput);

void setLoSpdOpt(boolean enable);


void resetDev();

void busyCheck();

void run(byte dir, float stepsPerSec);

void move(byte dir, unsigned long numSteps);

void softStop();

void hardStop();

void softHiZ();

void hardHiZ();

long getPos();

void resetPos();

void setMark(long newMark);

void setPos(long newPos);

void goTo(long pos);

void goToDir(byte dir, long pos);

void goHome();

void stepClock(byte dir);

void goUntil(byte action, byte dir, float stepsPerSec);

void releaseSw(byte action, byte dir);

void setParam(byte param, unsigned long value);

unsigned long getParam(byte param);

dSPINConfig();

Serial.begin(9600);

Serial.println("Dati comanda de pornire");

boardA.resetDev();

void loop()

if (Serial.available() !=0)
{

Serial.println("Citeste comanda");

Serial.read();

Serial.println("Incepe miscarea");

boardA.busyCheck();

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(stepsPerSecond);

boardA.setFullSpeed(stepsPerSecond);

boardA.move(dir, 300);

delay(1000);

boardA.softStop();

delay(1000);

Serial.println("Dati comanda a doua secventa");

void dSPINConfig(void)

boardA.configSyncPin(BUSY_PIN, 0);

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(10000);

boardA.setFullSpeed(10000);

boardA.setAcc(10000);

boardA.setDec(10000);

boardA.setSlewRate(SR_530V_us);

boardA.setOCThreshold(OC_750mA);

boardA.setPWMFreq(PWM_DIV_2, PWM_MUL_2);

boardA.setOCShutdown(OC_SD_DISABLE);

boardA.setVoltageComp(VS_COMP_DISABLE);

boardA.setSwitchMode(SW_USER);

boardA.setOscMode(INT_16MHZ_OSCOUT_16MHZ);
boardA.setAccKVAL(255);

boardA.setDecKVAL(255);

boardA.setRunKVAL(255);

boardA.setHoldKVAL(32);

Programul 3

#include <AutoDriver.h>

#include <dSPINConstants.h>

AutoDriver boardA(10, 6);

byte stepMode=STEP_FS;

float stepsPerSecond=500;

byte dir=FWD;

float stepsPerSec=500;

void setup()

void configSyncPin(byte pinFunc, byte syncSteps);

void configStepMode(byte stepMode);

void setMaxSpeed(float stepsPerSecond);

void setMinSpeed(float stepsPerSecond);

void setFullSpeed(float stepsPerSecond);

void setAcc(float stepsPerSecondPerSecond);

void setDec(float stepsPerSecondPerSecond);

void setOCThreshold(byte threshold);

void setPWMFreq(int divisor, int multiplier);

void setSlewRate(int slewRate);

void setOCShutdown(int OCShutdown);

void setOscMode(int oscillatorMode);

void setVoltageComp(int vsCompMode);


void setSwitchMode(int switchMode);

void setAccKVAL(byte kvalInput);

void setDecKVAL(byte kvalInput);

void setRunKVAL(byte kvalInput);

void setHoldKVAL(byte kvalInput);

void setLoSpdOpt(boolean enable);

void resetDev();

void busyCheck();

void run(byte dir, float stepsPerSec);

void move(byte dir, unsigned long numSteps);

void softStop();

void hardStop();

void softHiZ();

void hardHiZ();

long getPos();

void resetPos();

void setMark(long newMark);

void setPos(long newPos);

void goTo(long pos);

void goToDir(byte dir, long pos);

void goHome();

void stepClock(byte dir);

void goUntil(byte action, byte dir, float stepsPerSec);

void releaseSw(byte action, byte dir);

void setParam(byte param, unsigned long value);

unsigned long getParam(byte param);

dSPINConfig();

Serial.begin(9600);
Serial.println("Dati comanda de pornire");

boardA.resetDev();

void loop()

if (Serial.available() !=0)

Serial.println("Citeste comanda");

Serial.read();

Serial.println("Incepe miscarea");

boardA.busyCheck();

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(stepsPerSecond);

boardA.setFullSpeed(stepsPerSecond);

boardA.move(dir, 300);

delay(1000);

boardA.softHiZ();

delay(1000);

Serial.println("Dati comanda al doua secventa");

void dSPINConfig(void)

boardA.configSyncPin(BUSY_PIN, 0);

boardA.configStepMode(STEP_FS);

boardA.setMaxSpeed(10000);

boardA.setFullSpeed(10000);

boardA.setAcc(10000);

boardA.setDec(10000);

boardA.setSlewRate(SR_530V_us);
boardA.setOCThreshold(OC_750mA);

boardA.setPWMFreq(PWM_DIV_2, PWM_MUL_2);

boardA.setOCShutdown(OC_SD_DISABLE);

boardA.setVoltageComp(VS_COMP_DISABLE);

boardA.setSwitchMode(SW_USER);

boardA.setOscMode(INT_16MHZ_OSCOUT_16MHZ);

boardA.setAccKVAL(255);

boardA.setDecKVAL(255);

boardA.setRunKVAL(255);

boardA.setHoldKVAL(32);

You might also like