This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C51 long multiple mistake

Hi:
I use c8051f410,

Program Size: data=114.1 xdata=100 code=4633

I had to use the long multiple in program and find it can not be excecute properly.

The code is as below, Is this stack overflow? How can I fix it?

long x=0;
char cHour=0xff;
char cMin=0xff;
char cSec=0xff;
long gulbegintime=0; x=(ulong)3600*(ulong)cHour; printf("1 x =%lu \n",x); gulbegintime=60*cMin; printf("2 gulbegintime =%lu \n",gulbegintime); gulbegintime+=cSec; printf("3 gulbegintime =%lu \n",gulbegintime);

print result:

1 x =4294963696
2 gulbegintime =4294967236
3 gulbegintime =4294967235

0