Macro CMPEQ?TTT not found in macro file


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289

    Default Macro CMPEQ?TTT not found in macro file

    Yesterday, compiling for a PIC18F4585 I got this error.
    You can made it by your own:

    Dummy_Bit VAR Bit
    Dummy_Bit=(Dummy_Bit=Dummy_Bit) ;just 3 Bit-Vars in this equation !

    Then I get this error.

    Mel, some macros are missing ????
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    How can you have two equal signs in that statement? Mathematically or Logically it doesn't make sense, and the compiler is telling you it doesn't like it. It is however trying to Parse that line and attempting to call a routine to handle that expression... but there isn't one. When mathematicians figure out a way of handling that, you are safe in the knowledge that your PICBasic compiler already has the internal hooks to slot-in a routine for it...

    After you correct that, you'll also discover you've a ; (Assembler comment marker) when you should have had a ' (the PICBasic comment marker)... but a lot of people don't know that PICBasic will accept that... so you've discovered one of those undocumented features...

  3. #3
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Wink

    Melanie,

    OK, look at this (more complicated)

    Flag_Switch_activ_on_ Var Bit (1=activ on high, 0=activ on low)
    Switch Var PortC.0
    Is_Switch_aktiv Var Bit

    Is_Switch_aktiv= ( Flag_Switch_activ_on_ = Switch )
    (In Pascal ^ you would use ":=" in order to see the difference between a "fill that variable" and "compare/eqal")

    In words: If the content of "Flag_Switch_activ_on" is the same as the content of "Switch", the variable "Is_Switch_activ" should be set.

    If the second "=" would be changed to a "<>", it is easy to use a "^" XOR instead...

    I have managed it in another way, maybe I write this missing macro on my own... ;-)
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You can only do mathematical equations or compares within parenthisis within a stacked statement. With this item...

    Flag_Switch_activ_on_ = Switch

    ... you are asking the contents of a Port PIN to be transferred into a variable... this is NOT an equation or a compare function and cannot be included in a single valid BASIC statement whilst simultaneously elsewhere within that same statement you are performing an equation.

    It still comes down to the fact you have TWO (or more) equal signs at different parts of a single statement which is not legal. Put Flag_Switch_activ_on_ = Switch on it's own line, then build your IF/THEN accordingly.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    In other languages such as Pascal, Logical comparisons are treated like a Mathmatical formula. Then after the formula is calculated, any non-zero number is considered TRUE. Consequently, the result of that formula can be assigned to another variable if so desired.

    In PicBasic, that would require additional time, temporary variables and code space. Things that don't matter on a computer with GIGA hz, ram, and disk space. But matters alot for a PIC.

    Fotunately, the same things can be accomplished in different ways. For instance...

    Is_Switch_aktiv= ( Flag_Switch_activ_on_ = Switch )

    can be like this...

    Is_Switch_aktiv= ( Flag_Switch_activ_on_ ^/ Switch ) &nbsp; &nbsp; &nbsp; ; ^/ is "Not Exclusive OR"


    To see how that works we can look at the Truth Tables.
    <table border="0" cellspacing="7" cellpadding="4"> <tr> <td> <table CELLSPACING="0" BORDER="1" CELLPADDING="2" WIDTH="202"> <tr> <td WIDTH="99%" HEIGHT="16" colspan="3"> <p align="center">Equals sign</td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">A</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">B</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">Out</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> </tr> </table> </td> <td> <table CELLSPACING="0" BORDER="1" CELLPADDING="2" WIDTH="202"> <tr> <td WIDTH="99%" HEIGHT="16" colspan="3"> <p align="center">Exclusive OR&nbsp; ^ </td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">A</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">B</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">Out</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"> <p ALIGN="CENTER"><font face="Arial" size="2">0</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"> <p ALIGN="CENTER"><font face="Arial" size="2">1</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"> <p ALIGN="CENTER"><font face="Arial" size="2">1</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"> <p ALIGN="CENTER"><font face="Arial" size="2">0</font></td> </tr> </table> </td> <td> <table CELLSPACING="0" BORDER="1" CELLPADDING="2" WIDTH="202"> <tr> <td WIDTH="99%" HEIGHT="16" colspan="3"> <p align="center">Not Exclusive OR&nbsp; ^/</td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">A</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">B</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">Out</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">0</font></td> </tr> <tr> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> <td WIDTH="33%" HEIGHT="16"><font FACE="Arial" SIZE="2"> <p ALIGN="CENTER">1</font></td> </tr> </table> </td> </tr> </table>
    An Exclusive OR outputs a 1 when either of the inputs are a 1 but not both. This is the same as != in a logical expression.
    Since we want "=", simply invert the XOR result with "^/".
    <br>
    DT

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Talking

    OK(8chars)
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Talking

    <!--8chars-->

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. PBPro error "Macro USBINIT? not found in macro file"
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th October 2011, 09:06
  3. Replies: 6
    Last Post: - 4th November 2009, 13:36
  4. ERROR: Macro MOD?TCB not found in macro file.
    By JohnP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2009, 19:10
  5. 18F452 "Unknown Processor" errors
    By schwinn_rider in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th April 2006, 03:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts