Hi all
I use Proteus v7.1 SP2 to simulate ATmega32.
My test program is simple:
--------------------------------------
#include <avr/io.h>
int main()
{
float ek;
signed char i, j;
while (1)
{
i = PORTA;
ek += i - 2;
if (ek < 2) { j = 0; ek = 10;}
else j = 1;
}
return 0;
}
----------------------------------------------
When I use AVR Studio to simulate, all is ok:
* variable i is always equal 0
* ek has values 10, 8, 6, 4, 2, 0
* variable j had 0 or 1
But when i use Proteus, j variable is always equal 1. This means that equation (ek < 2) is always false.
The same program like above, but I change "float ek" to "signed int ek" then all is ok in AVRStudio and Proteus too.
Anyone can help me to explain this problem.
Thanks in advance
Regards
Muoinhohn