Page 1 of 1

help servo with pic 18F4550

Posted: Wed Feb 15, 2017 8:56 pm
by graziador
Hello everyone, my name is Graziano and I'm Italian (sorry for my english) .after scoring simple projects with Flowcode I tried to make something more complex (attached), the simulation works but in reality it does not work, can someone help me? thank you

Re: help servo with pic 18F4550

Posted: Thu Feb 16, 2017 12:44 pm
by Benj
Hello Graziano,

You are using the ReadAsVoltage component macro for the ADCs but then storing the floating point return value into a 16-bit Integer variable. You would be better off calling the ReadAsInt function to save the microcontroller having to unnecessarily deal with floating point values.

What hardware are you running the 18F device on? You might be best of trying a 1 second flasher routine to confirm the chip is running and at the right speed.
http://www.matrixtsl.com/wikiv7/index.p ... ED_flasher

In your configuration settings you have the Low Voltage Program / Watchdog Timer / Extended CPU set to enabled, I would advise to disable these settings. Also your oscillator settings don't seem to match up with your Project clock speed.

Your using the INTOSC oscillator which defaults to 1MHz. To change this to for example 8MHz you need to add a C icon to the start of your program containing this code. Also change the project options clock speed to 8000000.

Code: Select all

osccon = 0x70;
Finally we have noticed you may be using a pirate copy of Flowcode 5. Flowcode 7 is available for free for 30 days if you want to sample the latest and greatest. You not only support Matrix but the community here on the forum and the embedded market as a whole by buying our software.

Re: help servo with pic 18F4550

Posted: Thu Feb 16, 2017 8:57 pm
by graziador
Thanks for your help. I made the changes but still does not work


I proceeded to download the version 7 for free

Re: help servo with pic 18F4550

Posted: Fri Feb 17, 2017 10:51 am
by Benj
Hopefully this will work, I've tweaked the configuration settings slightly and moved the LED flash double check routine to repeat 3 times at the start.
servo rev2.fcf
(15.94 KiB) Downloaded 370 times

Re: help servo with pic 18F4550

Posted: Fri Feb 17, 2017 9:36 pm
by graziador
thanks for the help, but it does not work, I think I leave the project.