Page 1 of 1

Problem with Servo

Posted: Fri Jun 26, 2009 12:23 pm
by ITISVARESE
I test servo component and when i tried to compile flowcode example there is an
error:

http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\boostc\boostc.pic16.flowcode.exe -v -t PIC16F88 "1. Single servo motor control.c"
***************************************
Additional Debug info
sShortAppPath: C:\PROGRA~1\MATRIX~1\FLOWCO~1\boostc\BOOSTC~2.EXE
sAppPath: C:\Program Files\Matrix Multimedia\Flowcode V4\boostc\boostc.pic16.flowcode.exe
sAppFullSwitches: C:\PROGRA~1\MATRIX~1\FLOWCO~1\boostc\BOOSTC~2.EXE -v -t PIC16F88 "1. Single servo motor control.c"
sWorkingDir: C:\Program Files\Matrix Multimedia\Flowcode V4\Examples\Components\Servo
lengths = 79, 98, 72
***************************************
Return code = 1
Flowcode non Γ¨ in grado di compilare i codici C per via dei seguenti errori.
. Se la flowchart contiene codici C riesaminatela attentamente. Se no contattate il Supporto tecnico.
FINISHED

This with example from Flowcode; if i tried in real world a my simple circuit with servo example it compile but don't work.

Re: Problem with Servo

Posted: Fri Jun 26, 2009 2:52 pm
by Sean
Hello,

Thanks for highlighting this problem. The servo programs have not been saved to the examples folder correctly.

The reason for the compilation errors with the example servo programs is because they have been saved with the target device option set to PIC16F88. Unfortunately this device is not suitable for the Servo component because it only contains one Capture/Compare module for Timer 1, and the component requires two.

I have successfully compiled the programs with the target device changed to PIC16F877A which contains the required peripheral functions (View -> Project options -> Target:). Many other 16 and 18 series devices are compatible with the Servo component.

We will update these example programs as soon as possible.

Re: Problem with Servo

Posted: Fri Jun 26, 2009 3:25 pm
by ITISVARESE
Thank for reply,
but there is also other problem:
i have made other program with servo and 16F877A and compile ok and work ok in flowcode but
not work in real circuit.
Also stepper component program work in flowcode but not in real world !
I am sure(?!) that i made all ok because with other software circuit work but
not with software from V4; my mystmake or there is a V4 problem?
If You tested with real hardware can please send schematic and software V4 with work with them?

Re: Problem with Servo

Posted: Fri Jun 26, 2009 4:34 pm
by Sean
It seems that many of the example files have been saved with the Flowcode default settings. These settings include:
Target = PIC16F88
Oscillator = RC
Watchdog = ON

Also, some of the component connections are undefined.

After downloading a generic example program, it is worth checking that all the configuration settings match the target system (chip type, oscillator type, oscillator frequency, component connections, etc.).

To get the single servo program to work I:
Selected the PIC16F877A as the target
Configured the chip for HS oscillator
Turned off the watchdog, brown-out etc.
Connected the ADC component to RA1
Connected the servo component to RB7

The servos only need 0V, 5V, and the servo signal connecting. The servo signal can be derived directly from the PIC output.

Most stepper motors require a driver chip between the PIC and the motor. The schematic for our EB022 Motors board can be found on our website in the E-Block data sheet.

You will also need to make sure that the component is configured for the correct stepper motor type, resolution etc.

Re: Problem with Servo

Posted: Fri Jun 26, 2009 4:46 pm
by ITISVARESE
Thanks for reply;
Stepper now work very well: my mistmake with phases :oops: .
Servo in real world not work: there is nothing on pin that is connected to servo (only a short pulse at start testing with oscilloscope);
this simulation in V4 seem that work but is not correct.
THERE IS SOMEONE THAT BUILD A FUNCTIONAL CIRCUIT WITH SERVO AND SOFTWARE V4 THAT WORK IN REAL WORLD THAT CAN SEND
SCHEMATICH AND V4 SOFTWARE TO ME ?

Re: Problem with Servo

Posted: Mon Jun 29, 2009 10:56 am
by Sean
Here is a modified version of the single servo example program, configured to work with a PIC16F877a, with a 20MHz xtal.
1. Single servo 877a.fcf
(6 KiB) Downloaded 430 times
I have run the program on our HP-488 dev board so the control input uses the potentiometer connected to the ADC1 channel. The servo output is connected to Port C, Pin 0.

I used a Sanwa SRM-102 servo with the following connections:

Black wire - 0V (must be common with the PIC 0V)
Red wire - 5V
Blue wire - Port C, Pin 0.

If you do not want to use the analog channel as the control signal for the servo, you could modify the program to use a controlled counter, push-buttons, etc. to make the servo change position.

This program was derived directly from the example program and has been fully tested on target hardware.

As an additional test, the 20MHz xtal was replaced with a 4MHz xtal, and the program re-configured for 4MHz operation, with no affect on operation.

Re: Problem with Servo

Posted: Mon Jun 29, 2009 11:54 am
by ITISVARESE
I am not be able to work also with this;
because i don't use a dev. board but single stand alone circuit i would know if
there is other pin of pic ( I have naturally connected VCC and GND and MCRL at corrected voltage and OSCIN - OSCOUT to crystal with and without 10 pf capacitors)
connected and where because with this example and clock at 20MHz i have only a single impulse at
startup (PIN C0) that move servo only one time of 9,43 degree and nothing other...
ADC work corrected because i show value on lcd display and it value go from 0 to 255.
Circuit and pic are new and full functionally and work with other software and same pin.
Thank for all.

Re: Problem with Servo

Posted: Mon Jun 29, 2009 12:04 pm
by Sean
if you can send me full details of your circuit I will modify the example program to work in the required configuration and send a tested copy to you.

Re: Problem with Servo

Posted: Mon Jun 29, 2009 12:59 pm
by ITISVARESE
My circuit is simple: it's the same that You said:

Pic VCC and GND to +5V and 0V
PIC Mcrl to +5V
PIc PIN C0 to Servo Pin Control ( other Pin of servo to +5V and 0V)
Pic Pin A1 to cursor of trimmer with lateral to +5V and 0V
Pic CLKIN to crystal 20MHz (with or without cap)
Pic CLKOUT to crystal 20 MHz (with or without cap)
Other Pic Pin disconnected.

On Pin C0 with oscilloscope i find nothing....

Servo Hitec HS-422 (standard)

I have write a program for PIC (other tool) and it work with same configuration.

Re: Problem with Servo

Posted: Tue Jun 30, 2009 4:47 pm
by Sean
It is difficult to debug on hardware we are not familiar with.

Our usual suggestion is to write a simple Flowcode program that generates a slow (1Hz), flashing output (on Port C,0 in this case). An LED can be used to check if the program is running, the frequency is correct, and the output signal is reaching its destination.

I'm not sure if the chip will run successfully without the decoupling capacitors connected to the crystal. Microchip recomment 15-33pF for 20MHz crystals (10-22pF for resonators)

Re: Problem with Servo

Posted: Wed Jul 01, 2009 11:28 am
by ITISVARESE
Dear Sean,
I have just debugged my hardware and it is ok;
i want only a confirm that Your hardware that You have used for test in real world
(or development board) have pin connected exactly like i have wrote in my previous post
ed only these because i don't see work my servo component in real circuit;
in this case is my error.....
Thanks