Re: [WheelWatcher] WW-01 Code
CURTIS M ARMER wrote:
My CCS compiler version is 4.068
I wrote this code with 3.234. Not sure if this matters, but could be a
clue. I know when I was more actively using CCS that they seemed to
have lots of trouble producing a stable version of their compiler.
#define DEBUG_SNS 1
#define DEBUG_STAT 1
#define RC_SERVO_MODE 1
#ifdef RC_SERVO_MODE
#define ZERO_SERVOS 1
#endif
//#define MARKIII_SENSOR_BOARD_HBRIDGE_MODE 1
#define LEFT_CLK_ON_TIMER_1 1
//#define NESTED_LOOPS 1
#define ENCODER_TEST 1 // use this to verify that your encoders are working
#define MOTOR_TEST 1 // use this to verify that your motors or servos are
wired right, and spin the right way
#define SPEED_TEST 1 // use this to test velocity control
#define POSITION_TEST 1 // use this to test position control
#ifdef ENCODER_TEST
#ifndef DEBUG_SNS
#define DEBUG_SNS 1 // this must be on for encoder test
#endif
#endif
Those all look ok. I suggest skipping the MOTOR_TEST for now, and
trying to zero the servos, then doing the speed test.
I did modify the first couple lines of void setup() to get motor directions
correct. As shown below.
lw = &lwheel;
// lwheel.high_fwd_dir = FALSE;
lwheel.pos_fwd_pw = TRUE;
rw = &rwheel;
rwheel.pos_fwd_pw = FALSE;
// rwheel.high_fwd_dir = TRUE;
The lines that are commented out were added so I could get the directions
correctly. If I leave them commented out I still have same problem.
They're not the problem, I'm pretty sure.
This is all I have changed. My main goal is to get this working of a 18F4520
since it has more memory and internal oscillator so I am just trying to make
sure it working before that. Thanks again
The other variable here is how you have the system powered. You should
provide an approximately 6v supply to the servos, which is usually done
straight from a battery pack with a switch in series so you can turn it
off. You also need to supply regulated 5v to the WW-01s, as well as to
the PIC. Make sure the ground of the servo supply is connected to the
ground of the PIC and WW-01 supply, especially if the supplies to the
PIC and the servos are done from different sources (i.e., different
battery packs). If the grounds of the two supplies are not connected,
then the control pulse that the PIC is sending to the servos won't be
guaranteed to be the correct logic level, so the servo may or may not
respond as expected.
Finally, check the fuse settings on your PIC, and the clock oscillator
or resonator settings. If the clock rate is wrong, then the timing of
the pulses going to the servos will be wrong; if the timing is off
enough, the servos won't move.
-Pete
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.