|
Forum Index : Microcontroller and PC projects : Logical NOT not working as expected
| Author | Message | ||||
| JohnL Senior Member Joined: 10/01/2014 Location: SeychellesPosts: 128 |
Micromite Plus Firmware 4.07. NOT 0 returns 1 as expected, single bit. Logical NOT returns 0 for all other values? I would expect NOT to work in BASIC with at least a 16 bit integer (0 - &HFFFF) If NOT only works with a single bit than it is almost useless in BASIC? |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6349 |
AND, OR and XOR are integer bitwise operators so you can usually use XOR to get a bitwise NOT. NOT is useful in IF statements. Jim VK7JH MMedit |
||||
| JohnL Senior Member Joined: 10/01/2014 Location: SeychellesPosts: 128 |
Thanks Jim, That works. Just to clarify for anyone else that does not know the details. If you want to invert (NOT) a 16 bit integer using XOR. you have to XOR the number with &HFFFF. Regards John |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |