CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Nubotics WW01 Servo Encoder

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Nubotics WW01 Servo Encoder
PostPosted: Wed Apr 08, 2009 11:43 am     Reply with quote

Has anyone used the Nubotics WW-01 encoder and the example program posted on their site? I can't get it to work on the 16f877 and I am trying to port to a 18F4520.

Also when using a crystal oscillator as a clock does it matter if it puts out a square wave or sine wave?

Thanks
Guest








PostPosted: Thu Apr 09, 2009 6:37 am     Reply with quote

So I take it nobody has worked with this encoder. So how about my crystal oscillator question? Does it matter if its a sine wave or square wave?

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 09, 2009 8:35 am     Reply with quote

Yes, the external clock should be a square wave.

Look at this figure in the back of the 16F877 data sheet:
Quote:
FIGURE 15-6: EXTERNAL CLOCK TIMING

It gives the high and low time requirements for the clock signal.
For XT (which is specified as 4 MHz maximum), it says the high and low
times are 100 ns minimum. The rise and fall times are 25 ns max.
That's 100 ns + 25 ns + 100 ns + 25 ns = 250 ns total = 4 MHz.
A 4 MHz signal which has high and low times of 100 ns will look like
a square wave on the oscillocope.
Guest








Expert Programmer Help Needed.
PostPosted: Mon Apr 13, 2009 6:39 pm     Reply with quote

Ok, I cant get the sample code below to work. I am able to go through the encoder test and when I manually
turn the wheels I see positions change. Then I hit enter to see the individual
wheels turn but nothing turns. If I comment out the #define
LEFT_CLK_ON_TIMER_1 the wheels just turn constantly. After zeroing the wheels the program still work correctly. On the PIC itself B1 and
B2 go directly to the servos B4 and B5 are connected to the dir lines of
encoder, C0 left servo clk A4 right servo clk. I did try the servo.c file and was able to turn the servos correctly using another sample program but I want to be able to use the encoders. I was going to try to port to a pic18F4520 since it has built in clock but its not working even with a 16f877.

Thanks!

Sample code:
http://www.nubotics.com/support/ww01/code/ccs_c/ww01_picc_square.c.php
Guest








PostPosted: Tue Apr 14, 2009 5:13 pm     Reply with quote

Can anyone help with this problem?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 14, 2009 6:29 pm     Reply with quote

Their sample code has a large number of #ifdef's that are used to configure the options. The software also expects an external H-Bridge circuit that is identical to their MarkIII sensor board. There is a #define
statement in the code that is currently enabling that mode. There are
tons of other #define statements that must be analyzed to decide if
they are appropriate for your hardware.

Also, you've been in contact with the author of the sample code.
I can tell that by looking at the April 2009 Gzip'ed archives here:
http://list.nubotics.com/pipermail/wheelwatcher/
Do you expect us to know more about the program than he does ?


c:\windows\desktop\ww01_picc_square.c
Code:

#ifdef RC_SERVO_MODE
#ifdef ENCODER_TEST
#ifdef RC_SERVO_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef RC_SERVO_MODE
#ifdef LEFT_CLK_ON_TIMER_1
#ifdef LEFT_CLK_ON_TIMER_1
#ifdef DEBUG_SNS
#ifdef RC_SERVO_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
#ifdef LEFT_CLK_ON_TIMER_1
#ifdef DEBUG_SNS
#ifdef DEBUG_SNS
#ifdef DEBUG_STAT
#ifdef NESTED_LOOPS
#ifdef RC_SERVO_MODE
#ifdef DEBUG_STAT
#ifdef DEBUG_STAT
#ifdef ENCODER_TEST
#ifdef MOTOR_TEST
#ifdef ZERO_SERVOS
#ifdef SPEED_TEST
#ifdef POSITION_TEST

c:\windows\desktop\ww01_picc_square.h
Code:
#ifdef RC_SERVO_MODE
#ifdef REV1_BOARD
#ifdef REV2_BOARD
#ifdef MARKIII_BOARD
#ifdef RC_SERVO_MODE
#ifdef LEFT_CLK_ON_TIMER_1
#ifdef PROTO_LED_SWITCHES
#ifdef RC_SERVO_MODE
#ifdef PROTO_LED_SWITCHES
#ifdef MARKIII_SENSOR_BOARD_HBRIDGE_MODE
Guest








PostPosted: Tue Apr 14, 2009 7:19 pm     Reply with quote

No, I dont expect you to know more than the programmer but I was hoping with your expertise you would be able to spot any problems I have missed. You do not need an hbridge at all if you using it in servo mode. I think there just may be a problem with the routines used to set up the pulses for the servo.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 14, 2009 7:26 pm     Reply with quote

I can try it. Post your criteria for a successful test. What do you want
to see the code do ? (That can be observed with an oscilloscope).
I don't have their specific H-Bridge hardware.
Guest








PostPosted: Tue Apr 14, 2009 7:44 pm     Reply with quote

OK, I would just like to be able to run through the test and have them be successful. Using RC servo mode and all debug test enabled. The HBridge will be commented out since I am not using it. B1 and B2 go to servos and B4,B5 connected to direction lines and C0,A4 are clk lines.

With the LEFT_CLK_ON_TIMER_1 uncommented I can manually turn the servos to test encoders and that works. But the next test to test motors fails. The servos do not turn at all. Talking to the author the code was originally compile with version 3.234.

With LEFT_CLK_ON_TIMER_1 commented out the servos turn in opposite directions constantly. After calibrating the servos they just work sporadically.

Also I am not using a markIII board at all just a 16F877.

Thats why I think there is something wrong in how it generates the pulses for the servo.

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 14, 2009 8:21 pm     Reply with quote

I'm not sure how I'm going to do this since I don't have your servo.
I can look at output pins on the PIC with a scope, but without the
encoder input signals, I don't see how I can test anything.

You need to list your connections between the WW01 board and the PIC.
You need to list your Revision of the WW01 board.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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