PE 6.0.8.0 Directive #picaxe

techElder

Well-known member
I almost decided not to mention this, because I can't duplicate it right now. I'll just describe it in case someone else can expand on it.

In my regular project workspace, where I've been working on my 40X2 project. The workspace setting is set for a "40X2".

All programs have "#picaxe 40X2" directive and compile/download fine and accurate.

So, I wanted to test an interrupt problem in a separate program within my workspace. "New". New Tab; new file saved and all.

I created my separate program, but I forgot to add the "#picaxe 40X2" directive. I did add "#freq em32" and "setfreq em32".

I immediately notice how slow everything is. The "PAUSE 2000" were actually 2 seconds so I knew it was running at 8MHz instead of 32MHz.

I even went back and re-figured the pause numbers. I messed with other changes and saved the file several times and unloaded / reloaded the workspace several times with no change.

That's when I had the "Ah Ha!" moment and added the "#picaxe 40X2" directive and all was well.

To check that that was the problem, I commented out the "#picaxe 40X2" directive thinking that I would now be running back at 8MHz. Not so, Charlie.

Can't duplicate the slow experience now.

Something didn't read the workspace setting for "PICAXE Type", but only once?

Anyway, now I've mentioned it.
 

hippy

Technical Support
Staff member
The program would not have downloaded to the 40X2 if the editor had not compiled the code for a 40X2 so, despite no #PICAXE 40X2 directive, one must assume the Workplace Explorer setting was correct. The same compiled code would have been downloaded with or without the #PICAXE.

The #FREQ directive is not required for modern PICAXE, will have no affect and will simply be ignored. That was only necessary for older 28 and 40-pin PICAXE which could only run with a resonator. It allowed the downloader to adjust its baud rate to match how fast the PICAXE was actually running.

Could it be that you had #FREQ EM32 which had no effect, leaving the 40X2 running at its default 8MHz, later changed that or added SETFREQ EM32 which made it run at 32MHz ?

Otherwise the only thing I can think is that there was some hardware issue which caused the 40X2 to run slow, to fall back to default 8MHz operation. A subsequent reset or new download kicked things back into shape.
 

techElder

Well-known member
Actually, I added the #freq EM32 trying to get the speed to go up, but I had SETFREQ EM32 in there.

What you said makes sense, but it isn't as I remember it happening.

I'll try it on something else in a few days when I can stop.

Thanks, again!
 
Top