|
|
View previous topic :: View next topic |
Author |
Message |
hayate_kun
Joined: 22 Sep 2010 Posts: 8 Location: Malaysia
|
simple program:2 Phase Stepper Motor Driver CSD2130P (Vexta) |
Posted: Sat Dec 11, 2010 2:27 am |
|
|
Hello!
I'm trying to program a VEXTA STEPPER MOTOR. The I/O connector looks simple, so I put a simple coding just to look at how it would actually move. Unfortunately, it doesn't show any movement nor sound.
My coding:
Code: | #include <16F877A.h>
#device adc=8
#use delay(clock=20000000)
#fuses hs,noprotect,nowdt,nolvp
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N)
//#define use_portb_lcd TRUE
//#include <lcd.c>
#byte PORTA=5
#byte PORTB=6
#byte PORTC=7
#byte PORTD=8
#byte PORTE=9
void deg7_2();
void forbig();
void revbig();
void stopbig();
void delay();
void main()
{
int step;
set_tris_d(0x00);
//set_tris_b(0x00);
set_tris_c(0x80);
setup_port_a(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
setup_ccp1(ccp_pwm);
setup_ccp2(ccp_pwm);
setup_timer_2(T2_div_by_16,145,1);
set_pwm1_duty(0); // RC2 (ccp1)
do
{
set_pwm1_duty(120); // RC2 (ccp1)
output_low(pin_d5); //C.OFF
output_high(pin_d7); //CW
delay_ms(1000);
//output_low(pin_d6); //CCW
//output_high(pin_d4); //Timing
} while(TRUE);
}
|
Here's the datasheet (Please turn to pg 25-28 for pin description).
http://www.filedropper.com/vextadriver
Thank you in advance. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Sat Dec 11, 2010 3:24 am |
|
|
Start with 'which type of controller setup'?. There are two fundamentally different designs. One requires a direction control signal, and a separate pulse train. The other requires pulse trains on two different inputs for forward/reverse. The factory default, is two separate pulse trains (diagram at top right of P26). Unless you are going to use both PWM outputs to control these two signals, you need to set the using to use the '1 pulse input mode' (slightly further down the same page).
What are you connecting where?. You need the PWM output to connect to the PLS input, and the single PIC output pin connected to the 'DIR' line. Also remember these inputs are opto-couplers, so you need connections as shown at the top left of P26.
You need to turn off the PWM, when you change direction. (set the duty to 0).
Then what is your supply voltage?.
What stepper motor are you using?.
What is the specified maximum step rate for this motor?.
You are currently generating about 8.5KHz. This is probably well above the maximum rate the motor will run at, let alone start at. Typical 'pull in' step rates for this sort of motor, are around 1KHz - a _lot_ lower....
With the unit programmed for the one pulse train mode, you can prove that the motor wiring is right, and you PSU is OK, by simply pulsing the PLS input with a switch. Remember also when dealing with steppers, that the supply you use, needs to be able to 'cope' with having significant energy dumped 'back' into it by the controller. This is why simple transformer-rectifier-capacitor style supplies are still common for this type of application, rather than switch mode units. While you can get switch mode units capable of handling this, many 'standard' supplies will be destroyed, or (if better designed....), will shutdown....
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|