Charlie-plexing


Closed Thread
Results 1 to 40 of 61

Thread: Charlie-plexing

Hybrid View

  1. #1
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Demon and AvionicsMaster1
    Thank you for the information.
    I will try your suggestions though I think typing OR seems the easiest.
    Regards
    Jim

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    I will try your suggestions though I think typing OR seems the easiest.
    Though it looks cool to use those symbols I think it's easier just to type OR and know what it means
    .


    NOT sure about that , this is what the book says


    3.4.2 Logical vs. Bitwise

    Logical operators are very different than bitwise operators! There are

    circumstances under which PBP will allow the use of logical operators in
    expressions. This means that no error message will be generated when you
    mistakenly use a logical operator in a bitwise calculation. Consider the following:
    result = PORTB AND %00001111
    ' Returns logical result (1 or 0)
    The above example will compile and give a result. The value of the result can only
    be one or zero (true or false). If the intent is to use a bitwise operation to obtain a
    binary result, you MUST USE BITWISE OPERATORS:
    Code:
       i_term=0
       d_err=4
       i_err= 3 
       i_term= i_err |  d_err
       serout2 PORTA.0,84,[ "3 | 4 ",9,#i_term, 13,10]
       i_term= i_err OR d_err
       serout2 PORTA.0,84,[ "3 OR 4 ",9,#i_term, 13,10]
    PRINTOUT:
    3 | 4 7
    3 OR 4 65535
    Last edited by richard; - 29th June 2016 at 04:36.
    Warning I'm not a teacher

  3. #3
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Richard
    Looking at the PBP3 Compiler Manual it only shows OR as the description for
    | in the Bitwise operators. It does show OR as an operator in the Logical operators.

    Regards
    Jim

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Logical operators are not bitwise operators
    | does a bitwise OR
    OR does a Logical OR

    2 | 3 = 7
    2 OR 3 = ! 0 [ not nothing ]

    Warning I'm not a teacher

  5. #5
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Yes I made a mistake. There is a difference between bitwise operations and logical operations. I vehemently apologize for the second part of my post.

Members who have read this thread : 3

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