delay_ms compile error

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

delay_ms compile error

Post 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
Attachments
delay error.PNG
(10.51 KiB) Downloaded 2462 times

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: delay_ms compile error

Post 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.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Post 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
Attachments
SMS-x.fcfx
(11.16 KiB) Downloaded 216 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: delay_ms compile error

Post 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
Last edited by mnf on Sun Jan 07, 2018 1:42 pm, edited 1 time in total.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Post by jadiflow »

Hmmm, I need to look at that, because it is not my code as far as I can see....

Thanks, Jan

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Post 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

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Post 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

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: delay_ms compile error

Post by mnf »

Yes - might be a different compiler to when the help was written?

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

Martin

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Post 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

Post Reply