Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PCW CCS: Return from assembly function ?

Status
Not open for further replies.

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,045
pcw ccs

Hi,

I have a assembly function like that

void myfunc (void)
{

#asm
" // my assembly lines
"
return
"
"
return
#endasm

}

I want to know how can i return from the assembly function .
I tried the __return__ found it in the manual.
But it give me this error
And how can i return with a value in assembly function ?

Thanks
 

pcwh assembly

And how can i return with a value in assembly function ?

You could define a local (or even a global) variable in your program say an int8, you can use `C' variables from within inline assembly code.


What version are you running? There seems to be one update per week (sometimes even more).

- Jayson
 

Pharaoh of Egypt said:
I want to know how can i return from the assembly function.
I don't think you can return a value when you use void.

Instead of:
void myfunc (void)
it should be something like:
int8 myfunc (void)

Pharaoh of Egypt said:
I tried the __return__ found it in the manual.
According to the manual the correct command is _return_ wiht only one underline character at the ends and not two as you wrote: __return__

Pharaoh of Egypt said:
But it give me this error
Which error? You forgot to write.

Here is an example from the manual, it should be straightforward to use I think.

int find_parity (int data) {
int count;
#asm
movlw 0x8
movwf count
movlw 0
loop:
xorwf data,w
rrf data,f
decfsz count,f
goto loop
movwf _return_
#endasm
}
 

I can use _return_ function in line

int cf_read()
{
cf_data_tris = tris_d_in;
output_low(cf_n_oe);
_return_ = cf_data;
output_high(cf_n_oe);
}

it work!!!
 

Hi,

Ok i knew why _return_ doesn't work
Becuse i put in my code #CASE statment.
and i wrote _return_ in lower case letters
This is the bug
If i used #case i should write it in upper case letters _RETURN_
becuse if you looked for .LST file in symbol table area you will find _RETURN_ in upper case letters.

Thanks for your try
Bye
Pharaoh Of Egypt
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top