Page 1 of 1

delay_ms compile error

Posted: Sat Jan 06, 2018 1:26 pm
by jadiflow
Good day,

I am compiling a program for a 12F609 and receive what looks to me an error from the build-in delay function, see attached.
Is this a known bug, or am I doing something wrong?
I can send the code if needed but rather not through the forum.

Jan Didden
Linear Audio

Re: delay_ms compile error

Posted: Sat Jan 06, 2018 10:17 pm
by Kenrix2
The error is just before the delay function. That error is also breaking the delay function. What's just before the delay?

If your using C code, try Build/View C... and look around line 218 to spot the problem.

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 8:24 am
by jadiflow
I don't see anything funny there. And the error message does point to a redefinition issue in the PIC_CAL_Delay.c .

Here is a minimal FC with the same error, albeit in a different line (148).

Jan

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 10:42 am
by mnf
Hi Jan,

A quick look - and the problem seems to result after the asm {...} code in the main macro...

Disable this macro and it compiles ok...

Not sure what is wrong with the asm code though?

The Wiki details for asm
http://www.matrixtsl.com/wiki/index.php ... Properties
Don't seem correct...
asm movlw 5
Won't compile

However asm("movlw 5"); Does...

So in your macro...

Try

Code: Select all

asm ("movlw 0b00110111");
With each line of assembler as a single asm("..."); instruction?
etc


Martin

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 12:30 pm
by jadiflow
Hmmm, I need to look at that, because it is not my code as far as I can see....

Thanks, Jan

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 12:34 pm
by jadiflow
OK I see, any asm { .. } gets the error.
Still funny why it triggers a delay_ms() redefinition error...

Back to the manual.

Jan

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 12:45 pm
by jadiflow
Actually the specific example in the Help file is: asm movlw 5 .
Yet it throws an error.
The example statement in the Help file about an asm block seems corrupted....

Jan

Re: delay_ms compile error

Posted: Sun Jan 07, 2018 1:41 pm
by mnf
Yes - might be a different compiler to when the help was written?

Did splitting to individual asm("...") statements help?

Martin

Re: delay_ms compile error

Posted: Mon Jan 08, 2018 9:04 am
by jadiflow
I got bailed out by Jac Kersing from The Netherlands.

The correct syntax is:

#asm
_asm
banksel OPTION_REG
bsf OPTION_REG&0x7f,7 //set wpu through !gppu
movlw 0b00110111
banksel WPU
movwf WPU&0x7f //all wpu
_endasm
#endasm

Setting the oscillator speed by setting CONFIG register bits is no longer possible, but can be done through Build|Project Options|Configuration.

These are all changes from FC5, FC6 due to the change to the new compiler but are not yet documented in the Help file.

Thank you Jac!

Jan Didden
Linear Audio