PDA

View Full Version : Compf



Moldava
- 13th June 2004, 15:28
Hi,
is it correct to complement a variable (byte) the expression:

var=-var ?

thanks!!

Melanie
- 14th June 2004, 09:02
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.

Moldava
- 14th June 2004, 12:34
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