uday mehta
Advanced Member level 4
- Joined
- Dec 30, 2011
- Messages
- 104
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 1,298
- Activity points
- 1,979
i me counting something from 0 to 99999. here if i use an integer and increment it then it will reached its limit i.e. 65535. which data type i can use in this code...
here i want that variable "a" reach to 99999... if i change the data type to double then "br=b%10000" gives an error.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 #include<reg51.h> sbit ip = P3^0; void delay(unsigned int p) { int i,j; for(i=0;i<p;i++) for(j=0;j<1250;j++); } void main() { int val[]={0xc0,0xf9,0xa4,0xb0,0x91,0x92,0x82,0xf8,0x80,0x90}; int a,b,c,d,e,br,cr,dr,er,x; a=0; while(1) { b=a/10000; br=a%10000; c=br/1000; cr=br%1000; d=cr/100; dr=cr%100; e=dr/10; er=dr%10; x=b; P1=0x80; P2=val[x]; delay(10); x=c; P1=0x08; P2=val[x]; delay(10); x=d; P1=0x04; P2=val[x]; delay(10); x=e; P1=0x02; P2=val[x]; delay(10); x=er; P1=0x01; P2=val[x]; delay(10); while(ip==0); a=a+1; while(ip==1); } }
here i want that variable "a" reach to 99999... if i change the data type to double then "br=b%10000" gives an error.
Last edited by a moderator: