Jump to content

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




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



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.




Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

  • Create New...