HB25 and Position Controller RX transmission
Pedrito
Posts: 1
Hello,
I am using the Motor Mount and Wheel Kit with Position Controllers and 2 HB-25 motor controllers. The connection seems to be right because I can send information to the wheels, and they travel any position, but when I want the current position from the encoders, I don't get any data at all.
The odd part is that I can send information to the encoders, but I dont get anything back. The code I am testing is straight forward from the code given from parallax.
The program gets stuck in the "DisplayPosition" subroutine in "SERIN".
Thanks for your help!
Pedro
I am using the Motor Mount and Wheel Kit with Position Controllers and 2 HB-25 motor controllers. The connection seems to be right because I can send information to the wheels, and they travel any position, but when I want the current position from the encoders, I don't get any data at all.
The odd part is that I can send information to the encoders, but I dont get anything back. The code I am testing is straight forward from the code given from parallax.
The program gets stuck in the "DisplayPosition" subroutine in "SERIN".
Thanks for your help!
Pedro
' {$STAMP BS2pe} ' {$PBASIC 2.5} '--- Command Value Constants --- QPOS CON $08 'Query Position QSPD CON $10 'Query Speed CHFA CON $18 'Check for Arrival TRVL CON $20 'Travel Number of Positions CLRP CON $28 'Clear Position SREV CON $30 'Set Orientation as Reversed STXD CON $38 'Set TX Delay SMAX CON $40 'Set Speed Maximum SSRR CON $48 'Set Speed Ramp Rate '--- User Constants & Variables --- AllWheels CON 0 RightWheel CON 1 'ID of the right side Position Controller LeftWheel CON 2 'ID of the left side Position Controller CommPin PIN 2 'communication bus pin BaudValue CON 32 'for 19.2kbps Wheel VAR Byte 'Specifies which wheel to command for subroutines Distance VAR Word 'Used to set the travel distance RxData VAR Word 'Used to receive data '--- Initialization --- PAUSE 1000 SEROUT CommPin, BaudValue, [noparse][[/noparse]SREV + RightWheel] 'Reverses the sensor on the right SEROUT CommPin, BaudValue, [noparse][[/noparse]CLRP] 'Clears any prior position info 'Go forward 350 positions Wheel = AllWheels Distance = 200 GOSUB GoDistance 'Continually check the position of each wheel CheckLoop: Wheel = LeftWheel 'LeftWheel DEBUG "L= " GOSUB DisplayPosition Wheel = RightWheel DEBUG " R= " GOSUB DisplayPosition DEBUG CR GOTO CheckLoop END '--- Subroutines --- GoDistance: SEROUT CommPin, BaudValue, [noparse][[/noparse]TRVL + Wheel] SEROUT CommPin, BaudValue, [noparse][[/noparse]Distance.HIGHBYTE, Distance.LOWBYTE] RETURN DisplayPosition: SEROUT CommPin, BaudValue, [noparse][[/noparse]QPOS + Wheel] SERIN CommPin, BaudValue, [noparse][[/noparse]RxData.HIGHBYTE, RxData.LOWBYTE] RETURN
Comments
Do you happen to have an oscilloscope that you can watch the TX to verify that the signal is being sent from the position controller to the BASIC Stamp 2pe? Have you tried another IO pin to see if the issue is IO pin related?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com