Jump to content
Sign in to follow this  
DonC

Compiler error

Recommended Posts

I have a function defined as

 

void soft_putch(char txPort, char txPin, char c)

{

 

  // irrelevent code removed

 

 clear_bit(txPort, txPin);

 

}

 

and it is called from my main loop as

 

soft_putch(portb,1,'a');

 

The compiler generates the proper code to call this function, and passes the parameters correctly as

 

param00_soft_putch                0000004D

param01_soft_putch                0000004E

param02_soft_putch                0000004F

 

But inside the function where clear_bit is called, the second parameter is not passed correctly, the compiler generated code is

 

06079         ;;;;;;;; clear_bit(txPort, txPin);

Error[113]  : Symbol not previously defined (txPin)

04BD   104D           06080         bcf param00_soft_putch, txPin

 

I have to manually remove the symbol txPin and replace it with param02_soft_putch in in order for the code to assemble correctly. As in..

 

04BD   104D           06080         bcf param00_soft_putch, param01_soft_putch

 

Thanks

Share this post


Link to post
Share on other sites
Guest Pavel

Most of built-in functions are mapped on the target instructions and follow the format of these instructions. Consult the compiler help for the type of parameters for such functions. In this particular case its stated in the compiler help that clear_bit uses number or mpasm predefined constant as its second parameter. It will not work correctly with variables.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×