The Puma
23.04.2006, 11:30
Ich binn wass es experimenten met demm RN_MOTOR i2C
Ich habe desen motor
17HD2402-01N
hier die daten
http://www.moons.com.cn/pdf/17HD2402-01N.pdf
Wie must ich die motoranschlusse an die platine machen
ich habe jeztz dass folgenden
10 - blau
20 - rod
30 - gelb
40 - weiss
Ist dass richtig?
Ich hab folgendes CCS-C program fur zu testen
Leider tut dass es nicht immer
Un in vielen fallen leuchtet dass grune led auf!
Hieviel volt und ampere muss die spannungquelle haben
Bitte um hilfe
John
#include <18F4620.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOBROWNOUT,NOPUT,NOLVP,DEBUG,NOSTVREN,NOP ROTECT
#include <rn-motor.h>
void main() {
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SET_CURRENT);
i2c_write(0x00);
i2c_write(0xC0);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_STEPPER_MODE);
i2c_write(0x00);
i2c_write(0xFF);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SET_STEPS_SECOUND);
i2c_write(0x00);
i2c_write(0x50);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SWITCH_MOTOR_ON);
i2c_write(0x00);
i2c_write(0xFF);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_DIRECTION);
i2c_write(0x00);
i2c_write(0x00);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_ON_FOR_X_STEPS);
i2c_write(0x00);
i2c_write(0x00);
i2c_write(0x10);
i2c_stop();
delay_ms(10);
}
Und hier den include file
////////////////////////////////////////////////////////////////////////////
//// RN-MOTOR.H ////
//// Driver for RN-MOTOR controller board ////
//// ////
////////////////////////////////////////////////////////////////////////////
#ifndef RN_MOTOR_SDA
#define RN_MOTOR_SDA PIN_C4
#define RN_MOTOR_SCL PIN_C3
#endif
#use i2c(master,sda=RN_MOTOR_SDA,scl=RN_MOTOR_SCL,FORCE _HW)
#define RN_MOTOR_ADDR_WRITE 0x56
#define RN_MOTOR_ADDR_READ 0x57
// Stepper motor commandset
#define RN_MOTOR_SET_CURRENT 0x01
#define RN_MOTOR_REFERENCE_VOLTAGE 0x02
#define RN_MOTOR_STOP_CURRENT_ON 0x03
#define RN_MOTOR_DIRECTION 0x04
#define RN_MOTOR_ON_FOR_X_STEPS 0x05
#define RN_MOTOR_ON_UNTIL_STOP 0x06
#define RN_MOTOR_ON_ONE_STEP 0x07
#define RN_MOTOR_SET_STEPS_SECOUND 0x08
#define RN_MOTOR_OFF 0x09
#define RN_MOTOR_SWITCH_MOTOR_ON 0x0A
#define RN_MOTOR_DISPLAY_CONFIG 0x0B
#define RN_MOTOR_SLEEP_MODE 0x0C
#define RN_MOTOR_SELECT_GET_STEPS 0x0D
#define RN_MOTOR_STEPPER_MODE 0x0E
#define RN_MOTOR_SET_SLAVE_ID 0x0F
Ich habe desen motor
17HD2402-01N
hier die daten
http://www.moons.com.cn/pdf/17HD2402-01N.pdf
Wie must ich die motoranschlusse an die platine machen
ich habe jeztz dass folgenden
10 - blau
20 - rod
30 - gelb
40 - weiss
Ist dass richtig?
Ich hab folgendes CCS-C program fur zu testen
Leider tut dass es nicht immer
Un in vielen fallen leuchtet dass grune led auf!
Hieviel volt und ampere muss die spannungquelle haben
Bitte um hilfe
John
#include <18F4620.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOBROWNOUT,NOPUT,NOLVP,DEBUG,NOSTVREN,NOP ROTECT
#include <rn-motor.h>
void main() {
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SET_CURRENT);
i2c_write(0x00);
i2c_write(0xC0);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_STEPPER_MODE);
i2c_write(0x00);
i2c_write(0xFF);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SET_STEPS_SECOUND);
i2c_write(0x00);
i2c_write(0x50);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_SWITCH_MOTOR_ON);
i2c_write(0x00);
i2c_write(0xFF);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_DIRECTION);
i2c_write(0x00);
i2c_write(0x00);
i2c_write(0xFF);
i2c_stop();
delay_ms(10);
i2c_start();
i2c_write(RN_MOTOR_ADDR_WRITE);
i2c_write(0x0A);
i2c_write(RN_MOTOR_ON_FOR_X_STEPS);
i2c_write(0x00);
i2c_write(0x00);
i2c_write(0x10);
i2c_stop();
delay_ms(10);
}
Und hier den include file
////////////////////////////////////////////////////////////////////////////
//// RN-MOTOR.H ////
//// Driver for RN-MOTOR controller board ////
//// ////
////////////////////////////////////////////////////////////////////////////
#ifndef RN_MOTOR_SDA
#define RN_MOTOR_SDA PIN_C4
#define RN_MOTOR_SCL PIN_C3
#endif
#use i2c(master,sda=RN_MOTOR_SDA,scl=RN_MOTOR_SCL,FORCE _HW)
#define RN_MOTOR_ADDR_WRITE 0x56
#define RN_MOTOR_ADDR_READ 0x57
// Stepper motor commandset
#define RN_MOTOR_SET_CURRENT 0x01
#define RN_MOTOR_REFERENCE_VOLTAGE 0x02
#define RN_MOTOR_STOP_CURRENT_ON 0x03
#define RN_MOTOR_DIRECTION 0x04
#define RN_MOTOR_ON_FOR_X_STEPS 0x05
#define RN_MOTOR_ON_UNTIL_STOP 0x06
#define RN_MOTOR_ON_ONE_STEP 0x07
#define RN_MOTOR_SET_STEPS_SECOUND 0x08
#define RN_MOTOR_OFF 0x09
#define RN_MOTOR_SWITCH_MOTOR_ON 0x0A
#define RN_MOTOR_DISPLAY_CONFIG 0x0B
#define RN_MOTOR_SLEEP_MODE 0x0C
#define RN_MOTOR_SELECT_GET_STEPS 0x0D
#define RN_MOTOR_STEPPER_MODE 0x0E
#define RN_MOTOR_SET_SLAVE_ID 0x0F