Compf


Closed Thread
Results 1 to 3 of 3

Thread: Compf

  1. #1
    Moldava's Avatar
    Moldava Guest

    Default Compf

    Hi,
    is it correct to complement a variable (byte) the expression:

    var=-var ?

    thanks!!

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


    Did you find this post helpful? Yes | No

    Default

    It's a question that can easily be answered with a bit of thought and experimentation...

    Firstly, (1) Does it Compile?

    If Yes, therefore there must be an answer... so Secondly (2) to find out what kind of answer we get you can write a simple program like so...

    DataA=10
    LCDOut $FE,1,#DataA
    DataA=-DataA
    LCDOut " ",#DataA

    and put in a series of numbers for DataA. If you don't have an LCD, you can use a series of consecutive EEPROM locations for your answers and read them back in your programmer.

    Actually this method answers a lot of questions that get posted on the forum.

    Oh... before I forget... the answer to your question is Yes.

  3. #3
    Moldava's Avatar
    Moldava Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks,Melanie...
    the third way i found is that what i was trying to do compiled and worked ,what made me really happy...but i will add an lcd to my prototype board,it will give useful information....

    Maneco

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