Page 1 of 1

Instruction timing

Posted: Wed Oct 03, 2012 4:49 pm
by Dick_Miller_UK
Hi all,

I'm sure this probably been asked before and that somebody simple be able to point me in the right direction. What I'm after is some information relating to how long various Flowcode commands take to execute. For example in a recent thread the following statement was made:

"other members please correct me if im wrong, at 32 Mhz clock it takes 1 microsecond to turn a output on and off, at 4Mhz it takes 8 microseconds thats straight time without any delays"

Why does this take so long. How many instruction cycles are utilised in such a simple operation?

I understand that the answer is obviously complicated by issues including MIPS capability of chosen device and the clock.

The reason that I'm asking these questions is that I'm trying to do some fairly fast work (4uS) with a PIC16F88, and having problems whereby the timings end up quite a bit longer than I'm requesting. Am I simply asking too much of the 16F88 to switch an output at intervals of 4uS?? If so, what alternative device would you recommend. I only need simple capability such as the 88, but operating quickly.

Thanks in advance,
Dick Miller

Re: Instruction timing

Posted: Thu Oct 04, 2012 11:23 am
by Benj
Hello,

A 16F88 running flat out at 20MHz has an internal program speed of 5 million 8-bit instructions / second (5MIPs).

This equates to a instruction length of 200nS therefore you should get approx 20 instructions in a 4us period.

The I/O icons always do things like configuring the TRIS data direction register so if you wanted to save a bit of time you could use C icons instead to simply control the port without altering the tris register.

If you are using the delay icon then the compiler messages should report if the delays are inaccurate due to your specific clock setting.

I think I would probably have to see your program to be able to provide better suggestions.

Also maybe an AVR or a 16-bit PIC would be more suitable. The AVR's run 4 x faster then a PIC (<=20MIPS) at the same clock speed and the 16-bit PICs can run even faster (<=70MIPs).

Re: Instruction timing

Posted: Thu Oct 04, 2012 12:02 pm
by Dick_Miller_UK
Good morning Ben,

That explanation of the I/O icons doing other things was exactly what I was after. Unfortunately I'm definitely a hardware guy rather than software so moving to C isn't really an option or me.

I'm going to try using one of the faster 16 bit PIC's as you suggest. I also have some AVR devices I can try as well.

Thanks again.
Dick Miller