News:

Let's find out together what makes a PIC Tick!

Main Menu

Sbyte and sword

Started by Ivano, Oct 05, 2022, 11:32 AM

Previous topic - Next topic

Ivano

Hello everybody,
it is the first time that I use negative numbers and I have not understood how to handle them.
In the manual it indicates sbytes from -128 to + 127.
If I write:
Dim A as sbyte
A = - 2
Print at 1,1, dec A
Appears on the LCD display
254 instead of - 2
Same behavior though
Dim A as byte
Do I have to do some other operation to handle negative numbers?
thank you

John Lawton


Ivano

Quote from: John Lawton on Oct 05, 2022, 11:48 AMUse SDEC
How stupid, I had read it long ago in the manual but I did not remember it.
Thanks so much John