Page 1 of 1

problem with simulation time step, mips & measured freq

Posted: Wed Jan 11, 2012 12:34 am
by leonk
Lubin,
Great Blockset and excelent support!!!
I've found some differences between the setted and measured freq of a blinking LED. It appears that the freq depends on the MIPS and the simulation time step ts.
Ive found:
if ts[s] x MIPS < 0.0053 -> LEDfrec[hz] = 340 x ts
if ts[s] x MIPS > 0.0053 -> LEDfrec[hz] = 1.8 /MIPS

each time i change ts, i also change the period samples to get 1 hz blinking freq. In the attached model, i measured 1.82 hz

weird? am i misconfigurating the model? im using matlab2010b, dsPIC30f4013, with internal oscillator

Thank you very much,

Leonardo

PS: another doubt: the dspic datasheet says "The user can tune the FRC oscillator within a range of +10.5% (840 kHz) and -12% (960 kHz) in steps of 1.50%"
-> FRC[MHZ]: 8(nom); 7.04(min); 8.84(max).
-> ips = fosc/4,
-> ips = 1.76 a 2.21 mips
how does the blockset manage to set out of range ips?

Re: problem with simulation time step, mips & measured freq

Posted: Thu Jan 12, 2012 10:48 am
by LubinKerhuel
Leonardo,

Thanks for your question.
I mostly used the chips with an external quartz. I think that the blockset suport for the internal oscillator is pretty weak and I would not provide any garanty...

I joined Microchip to build-up a new blockset. This new blockset will handle differents oscillators in a much better way than it has been done with my custom blockset.
Thus if you are to use my custom blockset, considere using an external quartz which have been working very well so far (I used them exclusively !).
Considere switching to the Microchip official blockset in the next comming releases...

Regarding the tuning of the FRC resonator, it is not handled in my custom blockset. This will be handled in the Microchip futur blockset in prep...

Lubin