JP, Thank for the info and for your words.
paintiblack, yes of course. I've uploaded the files in a tar.z file
here:
http://groups.google.es/group/pinguinocard/files
(it's called pinguinodelay_newfiles.tar.z )
You have to do >tar xvf of that file within your pinguino folder.
And these files will be copied to their respective places:
<pinguinopath>/tools/share/sdcc/lib/pic16/pinguinodelay.lib
<pinguinopath>/tools/share/sdcc/include/pic16/pinguinodelay.h
<pinguinopath>/tools/share/sdcc/include/pic16/arduinodelay.c
The asm sources os the lib are not mandatory but are good to keep
there just in case:
<pinguinopath>/tools/share/sdcc/lib/src/pic16/pinguinodelay/
delay12tcy.S
<pinguinopath>/tools/share/sdcc/lib/src/pic16/pinguinodelay/
delay120tcy.S
And you have to do one more thing:
->Edit the main python script, and within the "def link(self)",
include a new line (it could just below this existing one: "-
llibm18f.lib",")
add this one: "-lpinguinodelay.lib,"
When you use delayms or delaymicroseconds functions, and compile it,
you will see at the debug box the following messages:
"link library pinguinodelay.lib
compilation done"
That's fine. There are no problems on that.
NOTES:
if you check the library and the .h file, you will notice that
delayMicroseconds function only accepts value from 1 to 255. That's
because it's a byte the maximum size that is possible to pass to the
asm routine. So in case you want to achieve a delay from 255 to 1000
microseconds, this function has to be called several times. So, for a
780 microseconds delay you should code it as:
delayMicroseconds(250); // first quarter of milisecond.
delayMicroseconds(250); //half a milisecond up to here.
delayMicroseconds(250); // 3/4 of a milisecond up to here.
delayMicroseconds(30); //a total of 780 microseconds finally here.
I've been struggling with that, but it's the only way to really
generate accurate microseconds delays. To handle values bigger than a
byte (unsigned char) within the delayMicroseconds routine makes
impossible to obtain exactly 1 microsecond (which is the most critical
value) and even 10 or 100. I've tested several possibilities with an
oscilloscope to get that really accurate microsecond delay. That's why
it was discarded variables bigger than a byte size.
For delays greater than a milisecond, you can use the already known
delayms function. This one accept values up to 4.294.967.295 (unsigned
long).
As soon as JP includes this modifications in the IDE code, I will
update this information at the Pinguino wiki pages.
Regards,
Sphinx.