help servo with pic 18F4550
Moderator: Benj
help servo with pic 18F4550
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
- Attachments
-
- servo.fcf
- (18 KiB) Downloaded 361 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: help servo with pic 18F4550
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.
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.
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;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: help servo with pic 18F4550
Thanks for your help. I made the changes but still does not work
I proceeded to download the version 7 for free
I proceeded to download the version 7 for free
- Attachments
-
- servo rev1.fcf
- (15.62 KiB) Downloaded 347 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: help servo with pic 18F4550
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: help servo with pic 18F4550
thanks for the help, but it does not work, I think I leave the project.