Aug 10, 2016
02:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 10, 2016
02:31 PM
Hi,
The following evaluates true if the variables are int8, but not true if uint8 (which is correct).
// Turn relays on if over set level
if(relay[0] >= dataLocal.level + dataLocal.hysteresis)
{
FET_1_Write(1);
}
The values are: relay[0] = 0, dataLocal.level = 128, dataLocal.hysteresis = 10.
What am I missing here? it seems like it is defying computer logic and calling 0 greater than 138...
Thank you,
Tom
Solved! Go to Solution.
1 Solution
Anonymous
Not applicable
Aug 11, 2016
01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 11, 2016
01:50 AM
Hi Tom
for uint8 Types 128u + 10u = 138u for int Types 128 + 10 = -118 ! Reiner
4 Replies