Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Olgierd Eysymontt <olgierd@te...>  20060505 16:37:15

Vangelis, I'll keep trying and I'll report to the list if I found problems in the way, thanks a lot for the answer, now I understand some problems I've had. Olgierd El vie, 05052006 a las 08:45 +0300, Vangelis Rokas escribi=F3: >  Original Message =20 > From: "Olgierd Eysymontt" <olgierd@...> > To: <sdccuser@...> > Subject: Re: [Sdccuser] pic16 intger division problem >=20 >=20 > > Was a stack size problem (bigger than 1 bank), which for me is a grea= ter > > problem because with a 256 bytes stack my program doesn't work and I > > need like 80 kb of code, so I have to use the large model and large > > stack, which seems not compatible with the division routines. >=20 > That's what I figured in the beginning! Sometimes I got the same resul= ts > when I was debugging the libraries. >=20 >=20 > > I changed the stack size to 256 bytes and the divisions gave me the > > right results. >=20 > That's fine! This isn't time for another bug in the math functions!:) >=20 >=20 > > I'd like to know if the large model and large stack model are ready > > yet ? or if there are plans for it, because they seems to work almost > > always except in cases like this one. >=20 > They are ready, but they are not extensively tested. You go on and use > large stack mode (and probably report to us any problems you may > experience). The problem with support functions is that the libraries > are build with small stack model. To use large stack model in your > program you should rebuild the whole library with large stack model. >=20 > This is similar to mcs51 port, but since there was no request in the > past for large stack model, we've focused to other things... >=20 > We might automate some day the creation of small and large stack model > libraries, but then we should also have small and large memory models a= nd > so on... >=20 >=20 > regards, > Vangelis >=20 >=20 >=20 >=20 >  > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with preintegrated technology to make your job = easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: Olgierd Eysymontt <olgierd@te...>  20060504 19:37:47

Hi, I'm trying a routine to divide two ints woth extrange results, I've tried with signed and unsigned ints ant the results are the same, depending of the numbers the results are correct or just '1'. For testing purposes I made a small program that sends the numbers to a serial port and this is what I get : (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the operation is i3=i1/i2, where i3 increases each cicle and i2 = 5 always) i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 When i1 is even the result is always 1, when is odd the answer is correct, and in the xase of unsigned ints, it's the other way, the ui1 is even the result is ok. Any clue ? Thanks in advance Olgierd 
From: Ken Jackson <KenJ<ackson@ie...>  20060504 20:52:21

You might find an existing algorithm you can use at this web site: <http://www.piclist.com/techref/microchip/math/div/index.htm>; Ken Jackson Olgierd Eysymontt writes: > Hi, I'm trying a routine to divide two ints woth extrange results, I've > tried with signed and unsigned ints ant the results are the same, > depending of the numbers the results are correct or just '1'. ... > > Any clue ? > > Thanks in advance > > Olgierd 
From: Olgierd Eysymontt <olgierd@te...>  20060504 21:02:48

Great !, thanks a lot Ken Olgierd El jue, 04052006 a las 16:52 0400, Ken Jackson escribi=F3: > You might find an existing algorithm you can use at this web site: >=20 > <http://www.piclist.com/techref/microchip/math/div/index.htm>; >=20 > Ken Jackson >=20 >=20 > Olgierd Eysymontt writes: > > Hi, I'm trying a routine to divide two ints woth extrange results, I= 've > > tried with signed and unsigned ints ant the results are the same, > > depending of the numbers the results are correct or just '1'. > ... > >=20 > > Any clue ? > >=20 > > Thanks in advance > >=20 > > Olgierd >=20 >=20 >=20 >  > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with preintegrated technology to make your job = easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: George M. Gallant, Jr. <ggallant571@co...>  20060504 21:36:34
Attachments:
Message as HTML

Oligierd, I am using sdcc2.5.4 and getting expected results with the following code: typedef unsigned short int uint16_t; typedef short int int16_t; extern int printf(char *fmt, ...); int main(void) { int i; uint16_t ui1, ui2, ui3; int16_t i1, i2, i3; i2 = 5; ui2 = 5; for (i = 20; i < 34; i++) { i1 = i; i3 = i1 / i2; printf("i1 %d i2 %d i3 %d ", i1, i2, i3); ui1 = i + 1; ui3 = ui1 / ui2; printf("%d ui2 %d ui3 %d\n", ui1, ui2, ui3); } return(0); } George On Thu, 20060504 at 15:37 0400, Olgierd Eysymontt wrote: > Hi, I'm trying a routine to divide two ints woth extrange results, I've > tried with signed and unsigned ints ant the results are the same, > depending of the numbers the results are correct or just '1'. For > testing purposes I made a small program that sends the numbers to a > serial port and this is what I get : > > (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the operation is > i3=i1/i2, where i3 increases each cicle and i2 = 5 always) > > > i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 > i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 > i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 > i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 > i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 > i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 > i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 > i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 > i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 > i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 > i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 > i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 > i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 > i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 > > When i1 is even the result is always 1, when is odd the answer is > correct, and in the xase of unsigned ints, it's the other way, the ui1 > is even the result is ok. > > Any clue ? > > Thanks in advance > > Olgierd > > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: Olgierd Eysymontt <olgierd@te...>  20060504 21:51:43

George, I'm using a simple function to send char through the second serial port (port one is hooked to a 485 link), this function uses itoa() and uitoa(), but works well because I see the remaining numbers ok, this is my routine to test the divisions: void test_divisions(){ int i; =09 signed int i1,i2,i3; uint ui1,ui2,ui3; =09 init_buff_comm(); // init comm i=3D0; while(1){ =09 i1=3Di++; i2=3D16; i3=3Di1/i2; send_str_len("i1 ",3); send_int(i1); =09 send_str_len(" i2 ",4); send_int(i2); =09 send_str_len(" i3 ",4); send_int(i3); =09 ui1=3D(unsigned int)i; ui2=3D5; ui3=3Dui1/ui2; =09 send_str_len(" ui1 ",7); send_int(ui1); =09 send_str_len(" ui2 ",5); send_int(ui2); =09 send_str_len(" ui3 ",5); send_int(ui3); =09 send_nl(); // a newline =09 // toggle some leds PORTAbits.RA1=3D0; delay100ktcy(5); PORTAbits.RA1=3D1; delay100ktcy(5); =09 } } Basically the same as yours except I'm not using printf. I'll keep trying, or may be update my version of sdcc (2.5.4). Olgierd El jue, 04052006 a las 17:36 0400, George M. Gallant, Jr. escribi=F3: > Oligierd, >=20 > I am using sdcc2.5.4 and getting expected results with the following > code: >=20 > typedef unsigned short int uint16_t; > typedef short int int16_t; >=20 > extern int printf(char *fmt, ...); >=20 > int main(void) > { > int > i; > uint16_t > ui1, ui2, ui3; > int16_t > i1, i2, i3; >=20 > i2 =3D 5; > ui2 =3D 5; >=20 > for (i =3D 20; i < 34; i++) > { > i1 =3D i; > i3 =3D i1 / i2; > printf("i1 %d i2 %d i3 %d ", i1, i2, i3); >=20 > ui1 =3D i + 1; > ui3 =3D ui1 / ui2; > printf("%d ui2 %d ui3 %d\n", ui1, ui2, ui3); > } > return(0); > } >=20 > George >=20 >=20 > On Thu, 20060504 at 15:37 0400, Olgierd Eysymontt wrote:=20 > > Hi, I'm trying a routine to divide two ints woth extrange results, I'= ve > > tried with signed and unsigned ints ant the results are the same, > > depending of the numbers the results are correct or just '1'. For > > testing purposes I made a small program that sends the numbers to a > > serial port and this is what I get :=20 > >=20 > > (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the operation= is > > i3=3Di1/i2, where i3 increases each cicle and i2 =3D 5 always) > >=20 > >=20 > > i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 > > i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 > > i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 > > i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 > > i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 > > i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 > > i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 > > i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 > > i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 > > i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 > > i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 > > i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 > > i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 > > i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 > >=20 > > When i1 is even the result is always 1, when is odd the answer is > > correct, and in the xase of unsigned ints, it's the other way, the ui= 1 > > is even the result is ok. > >=20 > > Any clue ? > >=20 > > Thanks in advance > >=20 > > Olgierd > >=20 > >=20 > >=20 > >=20 > >  > > Using Tomcat but need to do more? Need to support web services, secur= ity? > > Get stuff done quickly with preintegrated technology to make your jo= b easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Ger= onimo > > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&d= at=3D121642 > > _______________________________________________ > > Sdccuser mailing list > > Sdccuser@... > > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: Olgierd Eysymontt <olgierd@te...>  20060504 22:29:46

Was a stack size problem (bigger than 1 bank), which for me is a greater problem because with a 256 bytes stack my program doesn't work and I need like 80 kb of code, so I have to use the large model and large stack, which seems not compatible with the division routines. I changed the stack size to 256 bytes and the divisions gave me the right results. I'd like to know if the large model and large stack model are ready yet ? or if there are plans for it, because they seems to work almost always except in cases like this one. Olgierd El jue, 04052006 a las 17:51 0400, Olgierd Eysymontt escribi=F3: > George, > I'm using a simple function to send char through the second serial por= t > (port one is hooked to a 485 link), this function uses itoa() and > uitoa(), but works well because I see the remaining numbers ok, this is > my routine to test the divisions: >=20 >=20 > void test_divisions(){ > int i; > =09 > signed int i1,i2,i3; > uint ui1,ui2,ui3; > =09 > init_buff_comm(); // init comm > i=3D0; > while(1){ > =09 > i1=3Di++; > i2=3D16; > i3=3Di1/i2; > send_str_len("i1 ",3); > send_int(i1); > =09 > send_str_len(" i2 ",4); > send_int(i2); > =09 > send_str_len(" i3 ",4); > send_int(i3); > =09 > ui1=3D(unsigned int)i; > ui2=3D5; > ui3=3Dui1/ui2; > =09 > send_str_len(" ui1 ",7); > send_int(ui1); > =09 > send_str_len(" ui2 ",5); > send_int(ui2); > =09 > send_str_len(" ui3 ",5); > send_int(ui3); > =09 > send_nl(); // a newline > =09 > // toggle some leds > PORTAbits.RA1=3D0; > delay100ktcy(5); > PORTAbits.RA1=3D1; > delay100ktcy(5); > =09 > } >=20 > } >=20 > Basically the same as yours except I'm not using printf. I'll keep > trying, or may be update my version of sdcc (2.5.4). >=20 > Olgierd >=20 >=20 >=20 > El jue, 04052006 a las 17:36 0400, George M. Gallant, Jr. escribi=F3= : > > Oligierd, > >=20 > > I am using sdcc2.5.4 and getting expected results with the following > > code: > >=20 > > typedef unsigned short int uint16_t; > > typedef short int int16_t; > >=20 > > extern int printf(char *fmt, ...); > >=20 > > int main(void) > > { > > int > > i; > > uint16_t > > ui1, ui2, ui3; > > int16_t > > i1, i2, i3; > >=20 > > i2 =3D 5; > > ui2 =3D 5; > >=20 > > for (i =3D 20; i < 34; i++) > > { > > i1 =3D i; > > i3 =3D i1 / i2; > > printf("i1 %d i2 %d i3 %d ", i1, i2, i3); > >=20 > > ui1 =3D i + 1; > > ui3 =3D ui1 / ui2; > > printf("%d ui2 %d ui3 %d\n", ui1, ui2, ui3); > > } > > return(0); > > } > >=20 > > George > >=20 > >=20 > > On Thu, 20060504 at 15:37 0400, Olgierd Eysymontt wrote:=20 > > > Hi, I'm trying a routine to divide two ints woth extrange results, = I've > > > tried with signed and unsigned ints ant the results are the same, > > > depending of the numbers the results are correct or just '1'. For > > > testing purposes I made a small program that sends the numbers to a > > > serial port and this is what I get :=20 > > >=20 > > > (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the operati= on is > > > i3=3Di1/i2, where i3 increases each cicle and i2 =3D 5 always) > > >=20 > > >=20 > > > i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 > > > i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 > > > i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 > > > i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 > > > i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 > > > i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 > > > i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 > > > i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 > > > i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 > > > i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 > > > i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 > > > i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 > > > i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 > > > i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 > > >=20 > > > When i1 is even the result is always 1, when is odd the answer is > > > correct, and in the xase of unsigned ints, it's the other way, the = ui1 > > > is even the result is ok. > > >=20 > > > Any clue ? > > >=20 > > > Thanks in advance > > >=20 > > > Olgierd > > >=20 > > >=20 > > >=20 > > >=20 > > >  > > > Using Tomcat but need to do more? Need to support web services, sec= urity? > > > Get stuff done quickly with preintegrated technology to make your = job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache G= eronimo > > > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057= &dat=3D121642 > > > _______________________________________________ > > > Sdccuser mailing list > > > Sdccuser@... > > > https://lists.sourceforge.net/lists/listinfo/sdccuser >=20 >=20 >=20 >  > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with preintegrated technology to make your job = easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=120709&bid&3057&dat=12164= 2 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: Vangelis Rokas <vrokas@ot...>  20060505 05:45:46

 Original Message  From: "Olgierd Eysymontt" <olgierd@...> To: <sdccuser@...> Subject: Re: [Sdccuser] pic16 intger division problem > Was a stack size problem (bigger than 1 bank), which for me is a greater > problem because with a 256 bytes stack my program doesn't work and I > need like 80 kb of code, so I have to use the large model and large > stack, which seems not compatible with the division routines. That's what I figured in the beginning! Sometimes I got the same results when I was debugging the libraries. > I changed the stack size to 256 bytes and the divisions gave me the > right results. That's fine! This isn't time for another bug in the math functions!:) > I'd like to know if the large model and large stack model are ready > yet ? or if there are plans for it, because they seems to work almost > always except in cases like this one. They are ready, but they are not extensively tested. You go on and use large stack mode (and probably report to us any problems you may experience). The problem with support functions is that the libraries are build with small stack model. To use large stack model in your program you should rebuild the whole library with large stack model. This is similar to mcs51 port, but since there was no request in the past for large stack model, we've focused to other things... We might automate some day the creation of small and large stack model libraries, but then we should also have small and large memory models and so on... regards, Vangelis 
From: Olgierd Eysymontt <olgierd@te...>  20060505 16:37:15

Vangelis, I'll keep trying and I'll report to the list if I found problems in the way, thanks a lot for the answer, now I understand some problems I've had. Olgierd El vie, 05052006 a las 08:45 +0300, Vangelis Rokas escribi=F3: >  Original Message =20 > From: "Olgierd Eysymontt" <olgierd@...> > To: <sdccuser@...> > Subject: Re: [Sdccuser] pic16 intger division problem >=20 >=20 > > Was a stack size problem (bigger than 1 bank), which for me is a grea= ter > > problem because with a 256 bytes stack my program doesn't work and I > > need like 80 kb of code, so I have to use the large model and large > > stack, which seems not compatible with the division routines. >=20 > That's what I figured in the beginning! Sometimes I got the same resul= ts > when I was debugging the libraries. >=20 >=20 > > I changed the stack size to 256 bytes and the divisions gave me the > > right results. >=20 > That's fine! This isn't time for another bug in the math functions!:) >=20 >=20 > > I'd like to know if the large model and large stack model are ready > > yet ? or if there are plans for it, because they seems to work almost > > always except in cases like this one. >=20 > They are ready, but they are not extensively tested. You go on and use > large stack mode (and probably report to us any problems you may > experience). The problem with support functions is that the libraries > are build with small stack model. To use large stack model in your > program you should rebuild the whole library with large stack model. >=20 > This is similar to mcs51 port, but since there was no request in the > past for large stack model, we've focused to other things... >=20 > We might automate some day the creation of small and large stack model > libraries, but then we should also have small and large memory models a= nd > so on... >=20 >=20 > regards, > Vangelis >=20 >=20 >=20 >=20 >  > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with preintegrated technology to make your job = easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: George M. Gallant, Jr. <ggallant571@co...>  20060505 12:14:18
Attachments:
Message as HTML

Olgierd, I am unclear as to what are the differences in stack model and how they contributed to this problem. My test case is small (~3K bytes) and did not use much data space. George > On Thu, 20060504 at 18:29 0400, Olgierd Eysymontt wrote: > Was a stack size problem (bigger than 1 bank), which for me is a greater > problem because with a 256 bytes stack my program doesn't work and I > need like 80 kb of code, so I have to use the large model and large > stack, which seems not compatible with the division routines. > > I changed the stack size to 256 bytes and the divisions gave me the > right results. > > I'd like to know if the large model and large stack model are ready > yet ? or if there are plans for it, because they seems to work almost > always except in cases like this one. > > Olgierd > > El jue, 04052006 a las 17:51 0400, Olgierd Eysymontt escribió: > > George, > > I'm using a simple function to send char through the second serial port > > (port one is hooked to a 485 link), this function uses itoa() and > > uitoa(), but works well because I see the remaining numbers ok, this is > > my routine to test the divisions: > > > > > > void test_divisions(){ > > int i; > > > > signed int i1,i2,i3; > > uint ui1,ui2,ui3; > > > > init_buff_comm(); // init comm > > i=0; > > while(1){ > > > > i1=i++; > > i2=16; > > i3=i1/i2; > > send_str_len("i1 ",3); > > send_int(i1); > > > > send_str_len(" i2 ",4); > > send_int(i2); > > > > send_str_len(" i3 ",4); > > send_int(i3); > > > > ui1=(unsigned int)i; > > ui2=5; > > ui3=ui1/ui2; > > > > send_str_len(" ui1 ",7); > > send_int(ui1); > > > > send_str_len(" ui2 ",5); > > send_int(ui2); > > > > send_str_len(" ui3 ",5); > > send_int(ui3); > > > > send_nl(); // a newline > > > > // toggle some leds > > PORTAbits.RA1=0; > > delay100ktcy(5); > > PORTAbits.RA1=1; > > delay100ktcy(5); > > > > } > > > > } > > > > Basically the same as yours except I'm not using printf. I'll keep > > trying, or may be update my version of sdcc (2.5.4). > > > > Olgierd > > > > > > > > El jue, 04052006 a las 17:36 0400, George M. Gallant, Jr. escribió: > > > Oligierd, > > > > > > I am using sdcc2.5.4 and getting expected results with the following > > > code: > > > > > > typedef unsigned short int uint16_t; > > > typedef short int int16_t; > > > > > > extern int printf(char *fmt, ...); > > > > > > int main(void) > > > { > > > int > > > i; > > > uint16_t > > > ui1, ui2, ui3; > > > int16_t > > > i1, i2, i3; > > > > > > i2 = 5; > > > ui2 = 5; > > > > > > for (i = 20; i < 34; i++) > > > { > > > i1 = i; > > > i3 = i1 / i2; > > > printf("i1 %d i2 %d i3 %d ", i1, i2, i3); > > > > > > ui1 = i + 1; > > > ui3 = ui1 / ui2; > > > printf("%d ui2 %d ui3 %d\n", ui1, ui2, ui3); > > > } > > > return(0); > > > } > > > > > > George > > > > > > > > > On Thu, 20060504 at 15:37 0400, Olgierd Eysymontt wrote: > > > > Hi, I'm trying a routine to divide two ints woth extrange results, I've > > > > tried with signed and unsigned ints ant the results are the same, > > > > depending of the numbers the results are correct or just '1'. For > > > > testing purposes I made a small program that sends the numbers to a > > > > serial port and this is what I get : > > > > > > > > (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the operation is > > > > i3=i1/i2, where i3 increases each cicle and i2 = 5 always) > > > > > > > > > > > > i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 > > > > i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 > > > > i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 > > > > i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 > > > > i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 > > > > i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 > > > > i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 > > > > i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 > > > > i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 > > > > i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 > > > > i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 > > > > i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 > > > > i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 > > > > i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 > > > > > > > > When i1 is even the result is always 1, when is odd the answer is > > > > correct, and in the xase of unsigned ints, it's the other way, the ui1 > > > > is even the result is ok. > > > > > > > > Any clue ? > > > > > > > > Thanks in advance > > > > > > > > Olgierd > > > > > > > > > > > > > > > > > > > >  > > > > Using Tomcat but need to do more? Need to support web services, security? > > > > Get stuff done quickly with preintegrated technology to make your job easier > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > _______________________________________________ > > > > Sdccuser mailing list > > > > Sdccuser@... > > > > https://lists.sourceforge.net/lists/listinfo/sdccuser > > > > > > > >  > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with preintegrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.asus.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 > > _______________________________________________ > > Sdccuser mailing list > > Sdccuser@... > > https://lists.sourceforge.net/lists/listinfo/sdccuser > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 > _______________________________________________ > Sdccuser mailing list > Sdccuser@... > https://lists.sourceforge.net/lists/listinfo/sdccuser 
From: Olgierd Eysymontt <olgierd@te...>  20060505 16:39:27

Geroge, I use a communication block that is probably using most part if the stack, that's the difference, anyway I'll keep the recommendation of Vangelis in re compiling the suporting libraries. Olgierd El vie, 05052006 a las 08:14 0400, George M. Gallant, Jr. escribi=F3: > Olgierd, >=20 > I am unclear as to what are the differences in stack model and how > they contributed to this problem. > My test case is small (~3K bytes) and did not use much data space. >=20 > George >=20 > > On Thu, 20060504 at 18:29 0400, Olgierd Eysymontt wrote: > > Was a stack size problem (bigger than 1 bank), which for me is a grea= ter > > problem because with a 256 bytes stack my program doesn't work and I > > need like 80 kb of code, so I have to use the large model and large > > stack, which seems not compatible with the division routines. > >=20 > > I changed the stack size to 256 bytes and the divisions gave me the > > right results. > >=20 > > I'd like to know if the large model and large stack model are ready > > yet ? or if there are plans for it, because they seems to work almost > > always except in cases like this one. > >=20 > > Olgierd > >=20 > > El jue, 04052006 a las 17:51 0400, Olgierd Eysymontt escribi=F3: > > > George, > > > I'm using a simple function to send char through the second serial= port > > > (port one is hooked to a 485 link), this function uses itoa() and > > > uitoa(), but works well because I see the remaining numbers ok, thi= s is > > > my routine to test the divisions: > > >=20 > > >=20 > > > void test_divisions(){ > > > int i; > > > =09 > > > signed int i1,i2,i3; > > > uint ui1,ui2,ui3; > > > =09 > > > init_buff_comm(); // init comm > > > i=3D0; > > > while(1){ > > > =09 > > > i1=3Di++; > > > i2=3D16; > > > i3=3Di1/i2; > > > send_str_len("i1 ",3); > > > send_int(i1); > > > =09 > > > send_str_len(" i2 ",4); > > > send_int(i2); > > > =09 > > > send_str_len(" i3 ",4); > > > send_int(i3); > > > =09 > > > ui1=3D(unsigned int)i; > > > ui2=3D5; > > > ui3=3Dui1/ui2; > > > =09 > > > send_str_len(" ui1 ",7); > > > send_int(ui1); > > > =09 > > > send_str_len(" ui2 ",5); > > > send_int(ui2); > > > =09 > > > send_str_len(" ui3 ",5); > > > send_int(ui3); > > > =09 > > > send_nl(); // a newline > > > =09 > > > // toggle some leds > > > PORTAbits.RA1=3D0; > > > delay100ktcy(5); > > > PORTAbits.RA1=3D1; > > > delay100ktcy(5); > > > =09 > > > } > > >=20 > > > } > > >=20 > > > Basically the same as yours except I'm not using printf. I'll keep > > > trying, or may be update my version of sdcc (2.5.4). > > >=20 > > > Olgierd > > >=20 > > >=20 > > >=20 > > > El jue, 04052006 a las 17:36 0400, George M. Gallant, Jr. escrib= i=F3: > > > > Oligierd, > > > >=20 > > > > I am using sdcc2.5.4 and getting expected results with the follo= wing > > > > code: > > > >=20 > > > > typedef unsigned short int uint16_t; > > > > typedef short int int16_t; > > > >=20 > > > > extern int printf(char *fmt, ...); > > > >=20 > > > > int main(void) > > > > { > > > > int > > > > i; > > > > uint16_t > > > > ui1, ui2, ui3; > > > > int16_t > > > > i1, i2, i3; > > > >=20 > > > > i2 =3D 5; > > > > ui2 =3D 5; > > > >=20 > > > > for (i =3D 20; i < 34; i++) > > > > { > > > > i1 =3D i; > > > > i3 =3D i1 / i2; > > > > printf("i1 %d i2 %d i3 %d ", i1, i2, i3); > > > >=20 > > > > ui1 =3D i + 1; > > > > ui3 =3D ui1 / ui2; > > > > printf("%d ui2 %d ui3 %d\n", ui1, ui2, ui3); > > > > } > > > > return(0); > > > > } > > > >=20 > > > > George > > > >=20 > > > >=20 > > > > On Thu, 20060504 at 15:37 0400, Olgierd Eysymontt wrote:=20 > > > > > Hi, I'm trying a routine to divide two ints woth extrange resul= ts, I've > > > > > tried with signed and unsigned ints ant the results are the sam= e, > > > > > depending of the numbers the results are correct or just '1'. = For > > > > > testing purposes I made a small program that sends the numbers = to a > > > > > serial port and this is what I get :=20 > > > > >=20 > > > > > (i1,i2,i3 are ints, ui1, ui2,ui3 are unsigned ints and the ope= ration is > > > > > i3=3Di1/i2, where i3 increases each cicle and i2 =3D 5 always) > > > > >=20 > > > > >=20 > > > > > i1 20 i2 5 i3 1 ui1 21 ui2 5 ui3 1 > > > > > i1 21 i2 5 i3 4 ui1 22 ui2 5 ui3 4 > > > > > i1 22 i2 5 i3 1 ui1 23 ui2 5 ui3 1 > > > > > i1 23 i2 5 i3 4 ui1 24 ui2 5 ui3 4 > > > > > i1 24 i2 5 i3 1 ui1 25 ui2 5 ui3 1 > > > > > i1 25 i2 5 i3 5 ui1 26 ui2 5 ui3 5 > > > > > i1 26 i2 5 i3 1 ui1 27 ui2 5 ui3 1 > > > > > i1 27 i2 5 i3 5 ui1 28 ui2 5 ui3 5 > > > > > i1 28 i2 5 i3 1 ui1 29 ui2 5 ui3 1 > > > > > i1 29 i2 5 i3 5 ui1 30 ui2 5 ui3 6 > > > > > i1 30 i2 5 i3 1 ui1 31 ui2 5 ui3 1 > > > > > i1 31 i2 5 i3 6 ui1 32 ui2 5 ui3 6 > > > > > i1 32 i2 5 i3 1 ui1 33 ui2 5 ui3 1 > > > > > i1 33 i2 5 i3 6 ui1 34 ui2 5 ui3 6 > > > > >=20 > > > > > When i1 is even the result is always 1, when is odd the answer= is > > > > > correct, and in the xase of unsigned ints, it's the other way, = the ui1 > > > > > is even the result is ok. > > > > >=20 > > > > > Any clue ? > > > > >=20 > > > > > Thanks in advance > > > > >=20 > > > > > Olgierd > > > > >=20 > > > > >=20 > > > > >=20 > > > > >=20 > > > > >  > > > > > Using Tomcat but need to do more? Need to support web services,= security? > > > > > Get stuff done quickly with preintegrated technology to make y= our job easier > > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apac= he Geronimo > > > > > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D26= 3057&dat=3D121642 > > > > > _______________________________________________ > > > > > Sdccuser mailing list > > > > > Sdccuser@... > > > > > https://lists.sourceforge.net/lists/listinfo/sdccuser > > >=20 > > >=20 > > >=20 > > >  > > > Using Tomcat but need to do more? Need to support web services, sec= urity? > > > Get stuff done quickly with preintegrated technology to make your = job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache G= eronimo > > > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=120709&bid&3057&dat=12= 1642 > > > _______________________________________________ > > > Sdccuser mailing list > > > Sdccuser@... > > > https://lists.sourceforge.net/lists/listinfo/sdccuser > >=20 > >=20 > >=20 > >  > > Using Tomcat but need to do more? Need to support web services, secur= ity? > > Get stuff done quickly with preintegrated technology to make your jo= b easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Ger= onimo > > http://sel.asus.falkag.net/sel?cmd=3Dlnk&kid=120709&bid&3057&dat=121= 642 > > _______________________________________________ > > Sdccuser mailing list > > Sdccuser@... > > https://lists.sourceforge.net/lists/listinfo/sdccuser 
Sign up for the SourceForge newsletter:
No, thanks