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

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

delay_ms compile error

Postby jadiflow » Sat Jan 06, 2018 1:26 pm

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
delay error.PNG (10.51 KiB) Viewed 2311 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

Postby Kenrix2 » Sat Jan 06, 2018 10:17 pm

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: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Postby jadiflow » Sun Jan 07, 2018 8:24 am

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 49 times

mnf
Valued Contributor
Valued Contributor
Posts: 626
Joined: Wed May 31, 2017 11:57 am
Has thanked: 56 times
Been thanked: 346 times
Contact:

Re: delay_ms compile error

Postby mnf » Sun Jan 07, 2018 10:42 am

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: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Postby jadiflow » Sun Jan 07, 2018 12:30 pm

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: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Postby jadiflow » Sun Jan 07, 2018 12:34 pm

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: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Postby jadiflow » Sun Jan 07, 2018 12:45 pm

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: 626
Joined: Wed May 31, 2017 11:57 am
Has thanked: 56 times
Been thanked: 346 times
Contact:

Re: delay_ms compile error

Postby mnf » Sun Jan 07, 2018 1:41 pm

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: 249
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 16 times
Been thanked: 16 times
Contact:

Re: delay_ms compile error

Postby jadiflow » Mon Jan 08, 2018 9:04 am

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
These users thanked the author jadiflow for the post (total 2):
medelec35 (Mon Jan 08, 2018 10:18 am) • Benj (Wed Jan 10, 2018 6:33 pm)
Rating: 10%