DonC 0 Posted March 13, 2003 Report Share Posted March 13, 2003 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 Quote Link to post Share on other sites
Guest Pavel Posted March 13, 2003 Report Share Posted March 13, 2003 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 Quote Link to post Share on other sites
Recommended Posts
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.