Simulating program with interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
JG1
Posts: 20
Joined: Sat Jul 11, 2009 5:00 pm

Simulating program with interrupt

Post by JG1 »

I have created a program for ECIO40 which uses interrupt on TMR0, ADC converter, PWM ...
At all it includes the prog main and 12 sub-prog (about 1100 bytes)
My problem is that when simulating (1000Hz or less) the simulation is blocked on the end of the macro which follows the block "interrupt enable".
I add that when using PWM, with the V4 version, frequency and period values displayed on the specification window remain on zero
Other problem with PWM : the alternative pin of CCP2 (for ex RB3 with PIC18F4455) works when simulating but doesn't work on the real card or under Proteus.

Sorry for my approximate english and thanks in advance for your help
OP-SET-FlowV4-1V-Obst_MLI1_proteus_eng.fcf
Program mentioned in the topic
(21.73 KiB) Downloaded 353 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Simulating program with interrupt

Post by medelec35 »

did you realise that timer0 has been setup to count on external clock pulses on same pin as RA4 however in the properties it says interrupt on: retrieve form resource file? I have not got ECIO40 so not sure if should say retrieve form resource file... Im guessing not?

Not displaying frequency etc has been reported and should be fixed in V4. See here: http://www.matrixmultimedia.com/mmforum ... iod#p13835

See here for pwm fix: http://www.matrixmultimedia.com/mmforum ... =30&t=6503
I believe its only a problem with 10bit ch2 pwm. Fix is worth downloading.
Martin

JG1
Posts: 20
Joined: Sat Jul 11, 2009 5:00 pm

Re: Simulating program with interrupt

Post by JG1 »

Sorry "medelec35" but I have attempted multiple properties for the block "interrupt", beginning obviously by "internal clock", and the simulation always refuses to progress.
I specify again that the program works correctly with my hardware.
Unfortunately the PWM alternative pin doesn't work as well with the byte size.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Simulating program with interrupt

Post by medelec35 »

The reason you cannot select Timer0 in your interrupt icon is down to your definition file for 18F4455. Although simulation should work because when it shows 'retrieve form resource file' its is only displaying the wording from line
[TMR0]
;it is vital that this section remains exactly as-is (for all chips?)
Name=(this is retrieved from the resource file)

I believe what the definition file should say is:
[TMR0]
Name="TMR0"
But I think changing it wont work in this case because your ECIO is selected
as a source and not the chip its self.
Your simulation should not be affected,and you should still be able to choose interrupt on internal clock form properties.
not sure why your simulation is not running correctly, I will leave that to the experts. when running on my PC, simulation appeared to be running OK. int0 events were triggered OK. I am trying to help because I believe debugging software is a good way to learn, I not trying to help because I think I know all the answers, as I am the first to admit I don't...far from it.

Had a another quick look at simulation. Yes it is a bit strange, problem is the macro Telecommande is not ending when it should be. The end icon is reached, then interrupt is activated, then goes back to Telecommande end icon in a repeating loop. Also the frequency of interrupt time out is greyed out in Timer 0 properties.
Martin

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: Simulating program with interrupt

Post by Benj »

Hello

I have had a look at this program and I could replicate the problem here on my machine. Then I went into the interrupt settings and changed the clock to internal and for some reason the problem is now fixed. I wonder if this is because my FCD file does not have the interrupt naming problem.

I have attached the fixed Flowcode file as well as the updated FCD for the ECIO40. Hopefully this should be enough to solve the problem. If it does not solve the problem then if you can detail steps to replicate it then that would be a lot of help to getting the problem fixed.
Attachments
OP-SET-FlowV4-1V-Obst_MLI1_proteus_eng.fcf
(21.73 KiB) Downloaded 363 times
ECIO-40.fcd
(9.96 KiB) Downloaded 334 times

JG1
Posts: 20
Joined: Sat Jul 11, 2009 5:00 pm

Re: Simulating program with interrupt

Post by JG1 »

Thank you Medelec and Benj for your precious help.

With the new .fcd file the problem is nearly solved.
It remains that now the interrupt routine is executed much less often than before, is it normal ?

Is it possible for Benj to post a new .fcd file for PIC18f4455 (for proteus simulation) ?

Best regards

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: Simulating program with interrupt

Post by Benj »

Yes here you go,

Just as a quick note all these new FCD files will be available in V4.1.
Attachments
Flowcode 4 FCDs.zip
(587.44 KiB) Downloaded 411 times

Post Reply