Shop OBEX P1 Docs P2 Docs Learn Events
SX48 Microcontroller and the HB25 Motor Controller — Parallax Forums

SX48 Microcontroller and the HB25 Motor Controller

Kevin DoleseKevin Dolese Posts: 1
edited 2008-07-17 02:32 in General Discussion
I am having a trouble with the HB25 motor controller and the SX48 microprocessor. I have followed by the user manual until i cam across some discrepancies. In the user manual it says the following:

HB 25 Motor Controller

Pulse Input
1.0 ms Full Reverse
1.5 ms Neutral (Off)
2.0 ms Full Forward

When you evalute the source code provided for the Basic Stamp Microprocessors, they use 500ms, 750ms, and 1000ms. My source code for the SX48 is as follows:

DO WHILE HB_25 = 0 ' Wait For HB-25 Power Up
LOOP

LOW HB_25 ' Make I/O Pin Output/Low
PAUSE 10 ' Wait For HB-25 To Initialize
PULSOUT HB_25, 750, 1 ' Stop Motor 1
PAUSE 1
PULSOUT HB_25, 750, 1 ' Stop Motor 2 (If Connected)


Main:
FOR index = 0 to 250
·motor_forward = 750 + index
·motor_reverse = 1500 - index
·PULSOUT RE.6, motor_forward, 1
·PAUSE·1
·PULSOUT RE.6, motor_forward, 1
·PAUSE·6
NEXT


If anyone can help me, I would really appreciate it. In the mean time I will continue messing around with it until I figure it all out.

Thanks,

Kevin

Comments

  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-07-13 17:03
    PULSOUT in SX/B is in 10 uS units. If you want better resolution than that I would suggest you use PAUSEUS like this (both routines assume HB25 is an output):

    SUB STOP_HB25
      HB25 = 1
      PAUSEUS 1500
      HB25 = 0
      ENDSUB
    


    or...

    SUB MOVE_HB25
      tmpW1 = __wparam12
      HB25 = 1
      PAUSEUS tmpW1
      HB25 = 0
      ENDSUB
    

    Post Edited (JonnyMac) : 7/13/2008 5:25:38 PM GMT
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2008-07-17 02:32
    Kevin,

    I have not used the HB25 motor controller. However, it sounds like it operates very similar to hobby servo motors. I have used several of those! They tend to like a nice steady pulse train. The pulse ON time is important but so is the pulse OFF time. It did not have to be exact in my experience; but try to make it as close as you can when starting out.

    It is true that in the case of the hobby servos I have used I was able to obtain satisfactory performance out of them using a multiple of the specified timing durations. However, the HB25 may need the pulse train to be very close. I do not know.

    I suggest trying to make the pulse train close to what is stated in the motor controller manual and give it a steady and fixed pulse train to start out. Then once you have the motor moving at some constant speed you can experiment with varying the pulse characteristics.


    - Sparks
Sign In or Register to comment.