mmc01
Joined: 16 Jun 2010 Posts: 31
|
Calculate int and sent result to Array but it Error |
Posted: Tue Jul 16, 2013 11:25 pm |
|
|
I calculate time like this
Code: |
int next_time(int16 hr, int16 min, int pos){
lcd_gotoxy(1,2);
DS1307_ReadTime();
int16 minimVal;
int i=0,count = 0,check;
int16 hrk[],mnk[],all[];
int16 now_all;
int16 now_hr,now_min;
int16 a1,a2,a3;
now_hr = bcd2bin(RTC.hr);
now_min = bcd2bin(RTC.min);
hrk[pos] = hr;
mnk[pos] = min;
all[pos] =(hrk[pos]*60) ;
minimVal = (hrk[0]*60) + mnk[0];
now_all = (now_hr*60)+now_min;
printf("\r\n\n\n a=%ld, n=%ld",all[pos],hrk[pos]);
|
when I run this code and send value to function it show like this
Quote: |
a=180, n=3
a=735, n=4
|
if n=4 it should be 240 but why it is 735.
when I comment //now_all = (now_hr*60)+now_min; it show correct result. How to calculate it ? Please help me. |
|