Macro CMPEQ?TTT not found in macro file


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    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 )       ; ^/ 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

  2. #2
    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

  3. #3
    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 : 0

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