BHARGAVSHANKHALPARA
Junior Member level 3
- Joined
- May 6, 2010
- Messages
- 27
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- GUJARAT INDIA
- Activity points
- 1,592
Hi all...
i am programming ATMEGA32 microcontroller and ATMEL STUDIO 6 for programming in my application.
in my application user enter 3 difference value which i have store in char variable.
At the end i combine this 3 value in one variable and compare it with predefine value. when i combine in one variable it automatically convert into decimal.
for example i have 3 variable named S1,S2,S3
user enter S1=2,S2=0,S3=9;
at end combine value in TOTAL variable which is INT.
TOTAL = (S3 | (S2 << 4) | (S1 << 8));
so TOTAL value should be 209
but it shows after decimal conversation 521.
when i compare it with 209 this gives no result, but it gives result when my predefine value 521.
i want to get result when user enter 209 and my predefine value also 209.
i am programming ATMEGA32 microcontroller and ATMEL STUDIO 6 for programming in my application.
in my application user enter 3 difference value which i have store in char variable.
At the end i combine this 3 value in one variable and compare it with predefine value. when i combine in one variable it automatically convert into decimal.
for example i have 3 variable named S1,S2,S3
user enter S1=2,S2=0,S3=9;
at end combine value in TOTAL variable which is INT.
TOTAL = (S3 | (S2 << 4) | (S1 << 8));
so TOTAL value should be 209
but it shows after decimal conversation 521.
when i compare it with 209 this gives no result, but it gives result when my predefine value 521.
i want to get result when user enter 209 and my predefine value also 209.