Pb with Servo component

Moderator: Benj

Post Reply
Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Pb with Servo component

Post by Mathy »

Hi !

I have some troubles with the Servo component on 18F2520 and ECIO 28 for example.

The simulation on Flowcode and compilation works well but dont into the real life.

The simulation in Proteus doesn't work. If I assign an output to the servo0, for example B0, I have nothing on B0, only on A0 but the setting is B0...

I have the same problem with the Matrix Multimedia program example.

It is possible to check if i'm alone in the world in front of this bug ? :D

Have a nice day.
Attachments
1. Single servo motor control.fcf
(6 KiB) Downloaded 309 times

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Pb with Servo component

Post by Steve »

I've looked at the code generated by Flowcode and it seems fine to me (I don't have hardware handly to test with).

Please confirm which version of Flowcode you are using and also post the generated C code file and I should be able to help more.

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Pb with Servo component

Post by Mathy »

Hi Steeve,

I'm working on the servo component.

I already tried last year but without more result.

I made a little program who set 127 to the servomoteur number 0 connected to the RB2 pin.

It works well on ECIO40 but nothing on an other hardware with a 18F2420.
I tried with different hardware but without any success.
I think my hard is ok because It can flashing a led a the good rate on RA4.

You have the two little program on the attached files. One for my hard, the other for ECIO40.

Can you help me ? I realy need to use servomotor :-(
Attachments
Flowcode1ecio .fcf
ECIO40
(5.5 KiB) Downloaded 263 times
Flowcode1.fcf
18F2420 40 Mhz MCLR DISABLED
(5.5 KiB) Downloaded 281 times

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Pb with Servo component

Post by Mathy »

With Proteus simulation, I have the same problem on the 18F2420 but it works well with 18F6627.

Is it a problem on the FCD file ?

User avatar
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: Pb with Servo component

Post by Benj »

Hello,

In the chip configuration you could try disabling the Extended CPU enable bit.

Have you also tried the 1 second flasher technique on the 18F2420 to make sure that the chip is running at 40MHz? I take it you are using a crystal value of 10MHz.

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Pb with Servo component

Post by Mathy »

Hi Benj,

I'm out of the office now. I will try tomorrow in the morning about the Extended CPU Enable bit.

Im pretty sure that the chip running at 40 Mhz because I always choose 40 Mhz for all my boards in the project setting with a 10 Mhz crystal and the PLL x 4 set for the fuse.

My LED on RA4 flash at the good rate so I think the truth is out there !

Also, I try too choose a 18F242 instead of 18F2420 in the project setting. I import the hex generated in my 18F2420 and......it works.

But I think that de difference between the 242 and the 2420 could create some trouble in my application.....no ?
What do you think about that ?

Thanks for your help,

Mathy

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times
Contact:

Re: Pb with Servo component

Post by Mathy »

Hello !

I try the Extented CPU Enable bit tips but without any success.

I test in simulation with Proteus and in the real life on my own hardware.

I think you have Proteus because of your schematics we can see on many of your datasheet. If you want I can upload you the .DSN to try something.

Mathy

User avatar
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: Pb with Servo component

Post by Benj »

Hello Mathy,

Looking at the 18F2420 device it looks like it has a slightly unusual capture compare peripheral. I would compare the device datasheets of the 18F242 and the 18F2420 and see if you can spot the key differences in the CCPxCON registers. Then modify the C code to suit.

If you get stuck then let me know and I will have a look into this for you.

Post Reply