Help - Search - Members - Calendar
Full Version: Compiling Assembly Code
SourceBoost support forum > PIC and SX Embedded Programming > Assembler programming PIC and SX
twentysixdb
Hi All:
I am writing a simple assembly time delay routine and the only line that will NOT compile is the conditional. If have tried every permutation to try and get it to go, but no luck...compiler output follows code snipet.

void ms_delay( void )
{
asm
{
movlw 0xE6 ; 230 decimal
_dly1:
nop
nop
nop
nop
nop
nop
nop
nop
nop
addlw 0xFF
BTFSS STATUS,Z
goto _dly1
return
}
}

The compiler output is:

Building...
BoostC Optimizing C Compiler Version 6.96 (for PIC16 architecture)
failure
C:\PIC Projects\16F690\BoostC\Phone\Time Delay\Time Delay.c(202): error: error in built-in assembly
C:\PIC Projects\16F690\BoostC\Phone\Time Delay\Time Delay.c(203): error: jump to undefined label
"C:\Program Files\SourceBoost\boostc_pic16.exe" "Time Delay.c" -t PIC16F690
Exit code was 1.
Removing target: Time Delay.obj
Done

When I comment the conditional line it compiles! Any thoughts?
Thanks,
Craig
Martin Charlwood
Try using btfss _status,Z
status is a variable memory mapped to a register to access variables from the assembler you have to proceed the variable name with an underscore.

Best Regards.
Martin

QUOTE (twentysixdb @ Sep 12 2009, 10:29 PM) *
Hi All:
I am writing a simple assembly time delay routine and the only line that will NOT compile is the conditional. If have tried every permutation to try and get it to go, but no luck...compiler output follows code snipet.

void ms_delay( void )
{
asm
{
movlw 0xE6 ; 230 decimal
_dly1:
nop
nop
nop
nop
nop
nop
nop
nop
nop
addlw 0xFF
BTFSS STATUS,Z
goto _dly1
return
}
}

The compiler output is:

Building...
BoostC Optimizing C Compiler Version 6.96 (for PIC16 architecture)
failure
C:\PIC Projects\16F690\BoostC\Phone\Time Delay\Time Delay.c(202): error: error in built-in assembly
C:\PIC Projects\16F690\BoostC\Phone\Time Delay\Time Delay.c(203): error: jump to undefined label
"C:\Program Files\SourceBoost\boostc_pic16.exe" "Time Delay.c" -t PIC16F690
Exit code was 1.
Removing target: Time Delay.obj
Done

When I comment the conditional line it compiles! Any thoughts?
Thanks,
Craig

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.