Calling All Programmers- HELP!!!!!
NWUpgrades
Posts: 292
I am having an issue with a stepper motor controller that I had posted about earlier. I have since went to themfgr's web site and found their code. The problem is I am not the best at programming and was wondering if there is anyone that can convert the code to PBasic for me, or tell me whet I need to do. I have tried known working code that John sent me some time ago, but the motor will only go CW, unless I swap the wires from the motor to the controller, then I can get it to go CCW. I am using Pin 0 for Direction and Pin 1 for Step. Thanks in advance for any help.
Here is their code:
;16c54 step motor asm;Control by pulse and signals (JP1 Removed);==========================================MODE_A BTFSC PORTB,3 ;CP pouse in? GOTO MODE_A_BACK ;CP=1 no pouse BTFSC FLAG, 0 GOTO $+2 ;high-->low GOTO MODE_A ; BCF FLAG, 0 BTFSS PORTB,2 ;when RB2 =low voltage and RB2-DIR=high,TEMP=TEMP+1 ,contrarily TEMP=TEMP-1 GOTO A_LOOP1 INCF TEMP, F GOTO A_LOOP2 A_LOOP1 DECF TEMP, F A_LOOP2 CALL STEP_RUN ;one pouse step one,so differ frequency can adjust step motor speed. GOTO MODE_A MODE_A_BACK BSF FLAG, 0 ;normal RB3=H,FLAG D0=1 GOTO MODE_A
Here is their code:
;16c54 step motor asm;Control by pulse and signals (JP1 Removed);==========================================MODE_A BTFSC PORTB,3 ;CP pouse in? GOTO MODE_A_BACK ;CP=1 no pouse BTFSC FLAG, 0 GOTO $+2 ;high-->low GOTO MODE_A ; BCF FLAG, 0 BTFSS PORTB,2 ;when RB2 =low voltage and RB2-DIR=high,TEMP=TEMP+1 ,contrarily TEMP=TEMP-1 GOTO A_LOOP1 INCF TEMP, F GOTO A_LOOP2 A_LOOP1 DECF TEMP, F A_LOOP2 CALL STEP_RUN ;one pouse step one,so differ frequency can adjust step motor speed. GOTO MODE_A MODE_A_BACK BSF FLAG, 0 ;normal RB3=H,FLAG D0=1 GOTO MODE_A
Comments
I dont see how You got the code You posted to compile? But if you did thats cool.
I dont know if the SX28 would roll with the code You posted. Its ASM and NOT BASIC
________$WMc%______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
Post Edited ($WMc%) : 6/12/2009 1:54:55 AM GMT
So You did get Your code to compile with the BS2 editor?
_____$WMc%_______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
It looks like a form of assembly. I am not skilled enough to decode it. I can make out some, what you need is more info on that stepper. Like a data sheet. Or if you know its basic construction, you can try out various methods of moving known steppers. If all you have is that code, you will need to learn assembly.
Post Edited (Clock Loop) : 6/13/2009 2:28:47 AM GMT
Specifically.
You will find those guys in the SX forum.
I think it would be better if you started from scratch and use some code that already exists in the Parallax site.
Then, you could follow the code that was provided to you that may not be complete.
Lay out some requirements and some specs of the stepper you are aready using. Give us the input and output requirements that this system requires and what is the end results.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave W.
' {$STAMP BS2}
' {$PBASIC 2.5}
··· StepperDir····· PIN···· 0······················ ' direction control
··· StepperMove···· PIN···· 1······················ ' movement
··· CW············· CON···· 0
··· CCW············ CON···· 1
··· idx············ VAR···· Byte
··· Reset:
··· OUTPUT StepperDir
··· HIGH StepperMove····························· ' move on high-to-low transition
··· Main:
··· StepperDir = CW
··· FOR idx = 1 TO 100
··· PULSOUT StepperMove, 500
··· PAUSE 15
···· NEXT
··· StepperDir = CCW
··· FOR idx = 1 TO 100
··· PULSOUT StepperMove, 500
··· PAUSE 5
··· NEXT
··· GOTO Main
Try google, It will surprise You.
_____________$WMc%________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
Direction is straight forward , its either logic 1 or logic 0 , so set at a logic level it should go one way or the other if the provided pulses are ok and the jumpers are set right.
Maybe you could try a regular square wave using a simple piece of code
Mess with the 50 and see if it makes a difference. Go through the different combination of jumpers with each change
Jeff T.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Jeff T.