Page 1 of 1

C-Code error using asm

Posted: Tue Apr 01, 2008 2:10 pm
by jgriffin
I am attempting to use Flowcode (V3/PIC 16F877A) to demonstrate assembly language commands in a single C-Code block between BEGIN and END.

The C-Code block contains the following:

asm
{
bsf 3,5
movlw 000
mowf 0x85
bcf 3,5
movlw 0x00f
mowf 005
}

However, I get the following errors:

C:\Temp\Flowcode1.c(84): error: error in built-in assembly
C:\Temp\Flowcode1.c(86): error: error in built-in assembly
C:\Temp\Flowcode1.c(87): error: error in built-in assembly
C:\Temp\Flowcode1.c(89): error: error in built-in assembly

Could you tell me what I am leaving out?

Thanks,

Jack

Re: C-Code error using asm

Posted: Tue Apr 01, 2008 4:46 pm
by Sean
Hello Jack,

The assembler does not allow direct addressing of registers. The special function registers have pre-defined labels (_status etc.) so your asm code should look like this:

asm
{
bsf _status,5
movlw 0
movwf _porta
bcf _status,5
movlw 0x0f
movwf _trisa
}

Also the mowf command should be movwf.

Re: C-Code error using asm

Posted: Tue Apr 01, 2008 9:38 pm
by jgriffin
Sean,

Got it. Thanks a million.

Jack