From sbissonnette at microsyl.com Thu Mar 1 17:25:25 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Thu Mar 1 17:35:32 2007 Subject: [Icc-avr] Problem compiling bootloader References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> Message-ID: <002901c75c69$a7bbc250$0301a8c0@Sylvain> Hi, I have a MegaLoad user who have problem compiling the bootloader and I don't understand what is the problem. If someone could help me I will be please. Here is the ICC information > C:\iccv7avr\bin\imakew -f M.mak > iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small > C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\main.c > iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small > -Wa-g C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\assembly.s > iccavr -o > M -g -e:0x1000 -ucrtboot8k.o -bvector:0xc00.0x1000 -bfunc_lit:0xc34.0x1000 > -dram_end:0x2ff -bdata:0x100.0x2ff -dhwstk_size:16 -beeprom:0.256 -fihx_coff > -S2 @M.lk > !E (57): Address out of range 65535 is larger than max address > 4096 > C:\iccv7avr\bin\imakew.exe: Error code 1 > Done: there are error(s). Exit code: 1. Thu Mar 01 19:53:44 2007 > Yours truly Sylvain Bissonnette From richard-lists at imagecraft.com Thu Mar 1 18:00:15 2007 From: richard-lists at imagecraft.com (Richard) Date: Thu Mar 1 18:08:10 2007 Subject: [Icc-avr] Problem compiling bootloader In-Reply-To: <002901c75c69$a7bbc250$0301a8c0@Sylvain> References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> Message-ID: <6.1.0.6.2.20070301175944.07918e00@192.168.100.42> It's a bug with the new -e: flag and some other interaction. I am working on it. Sorry. At 05:25 PM 3/1/2007, Sylvain Bissonnette wrote: >Hi, > > I have a MegaLoad user who have problem compiling the bootloader and I > don't understand >what is the problem. If someone could help me I will be please. Here is >the ICC information > >>C:\iccv7avr\bin\imakew -f M.mak >>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g >>-Mavr_enhanced_small C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\main.c >>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g >>-Mavr_enhanced_small -Wa-g C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\assembly.s >>iccavr -o M -g -e:0x1000 -ucrtboot8k.o -bvector:0xc00.0x1000 >>-bfunc_lit:0xc34.0x1000 -dram_end:0x2ff -bdata:0x100.0x2ff >>-dhwstk_size:16 -beeprom:0.256 -fihx_coff -S2 @M.lk >>!E (57): Address out of range 65535 is larger than max address 4096 >>C:\iccv7avr\bin\imakew.exe: Error code 1 >>Done: there are error(s). Exit code: 1. Thu Mar 01 19:53:44 2007 // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From sbissonnette at microsyl.com Thu Mar 1 18:31:41 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Thu Mar 1 18:41:48 2007 Subject: [Icc-avr] Problem compiling bootloader References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> <6.1.0.6.2.20070301175944.07918e00@192.168.100.42> Message-ID: <001101c75c72$e9a91d30$0301a8c0@Sylvain> Thanks Richard, I stay tune for news on this problem, Sylvain ----- Original Message ----- From: "Richard" To: Sent: Thursday, March 01, 2007 9:00 PM Subject: Re: [Icc-avr] Problem compiling bootloader > It's a bug with the new -e: flag and some other interaction. I am working > on it. Sorry. > > At 05:25 PM 3/1/2007, Sylvain Bissonnette wrote: >>Hi, >> >> I have a MegaLoad user who have problem compiling the bootloader and I >> don't understand >>what is the problem. If someone could help me I will be please. Here is >>the ICC information >> >>>C:\iccv7avr\bin\imakew -f M.mak >>>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small >>>C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\main.c >>>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small >>> -Wa-g C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\assembly.s >>>iccavr -o >>>M -g -e:0x1000 -ucrtboot8k.o -bvector:0xc00.0x1000 -bfunc_lit:0xc34.0x1000 >>> -dram_end:0x2ff -bdata:0x100.0x2ff -dhwstk_size:16 -beeprom:0.256 -fihx_coff >>> -S2 @M.lk >>>!E (57): Address out of range 65535 is larger than max address >>>4096 >>>C:\iccv7avr\bin\imakew.exe: Error code 1 >>>Done: there are error(s). Exit code: 1. Thu Mar 01 19:53:44 2007 > > // richard (This email is for mailing lists. To reach me directly, please > use richard at imagecraft.com) > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From richard-lists at imagecraft.com Thu Mar 1 18:53:06 2007 From: richard-lists at imagecraft.com (Richard) Date: Thu Mar 1 19:01:04 2007 Subject: 7.12A compiler was: Re: [Icc-avr] Problem compiling bootloader In-Reply-To: <002901c75c69$a7bbc250$0301a8c0@Sylvain> References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> Message-ID: <6.1.0.6.2.20070301184719.07917c00@192.168.100.42> Due to a bug where the check was done, this error will be emitted for any bootloader build for devices with less than 64K of memory. Sorry. This fixes it: http://www.dragonsgate.net/pub/Betas/iccomavr.exe Put it in your bin directory. I will formally release 7.12A soon. At 05:25 PM 3/1/2007, Sylvain Bissonnette wrote: >Hi, > > I have a MegaLoad user who have problem compiling the bootloader and I > don't understand >what is the problem. If someone could help me I will be please. Here is >the ICC information > >>C:\iccv7avr\bin\imakew -f M.mak >>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g >>-Mavr_enhanced_small C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\main.c >>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g >>-Mavr_enhanced_small -Wa-g C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\assembly.s >>iccavr -o M -g -e:0x1000 -ucrtboot8k.o -bvector:0xc00.0x1000 >>-bfunc_lit:0xc34.0x1000 -dram_end:0x2ff -bdata:0x100.0x2ff >>-dhwstk_size:16 -beeprom:0.256 -fihx_coff -S2 @M.lk >>!E (57): Address out of range 65535 is larger than max address 4096 >>C:\iccv7avr\bin\imakew.exe: Error code 1 >>Done: there are error(s). Exit code: 1. Thu Mar 01 19:53:44 2007 // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From sbissonnette at microsyl.com Thu Mar 1 19:05:35 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Thu Mar 1 19:15:42 2007 Subject: 7.12A compiler was: Re: [Icc-avr] Problem compiling bootloader References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> <6.1.0.6.2.20070301184719.07917c00@192.168.100.42> Message-ID: <000d01c75c77$a59e5830$0301a8c0@Sylvain> Hi Richard Your path is not good http://www.dragonsgate.net/pub/Betas/iccomavr.exe Sylvain ----- Original Message ----- From: "Richard" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." ; "Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this." Sent: Thursday, March 01, 2007 9:53 PM Subject: 7.12A compiler was: Re: [Icc-avr] Problem compiling bootloader > Due to a bug where the check was done, this error will be emitted for any > bootloader build for devices with less than 64K of memory. Sorry. > > This fixes it: http://www.dragonsgate.net/pub/Betas/iccomavr.exe > > Put it in your bin directory. I will formally release 7.12A soon. > > At 05:25 PM 3/1/2007, Sylvain Bissonnette wrote: >>Hi, >> >> I have a MegaLoad user who have problem compiling the bootloader and I >> don't understand >>what is the problem. If someone could help me I will be please. Here is >>the ICC information >> >>>C:\iccv7avr\bin\imakew -f M.mak >>>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small >>>C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\main.c >>>iccavr -c -e -D__ICC_VERSION="7.12" -D_EE_EXTIO -DATMega48 -l -g -Mavr_enhanced_small >>> -Wa-g C:\DOCUME~1\MACIEJ~1\Pulpit\MEGALO~1\assembly.s >>>iccavr -o >>>M -g -e:0x1000 -ucrtboot8k.o -bvector:0xc00.0x1000 -bfunc_lit:0xc34.0x1000 >>> -dram_end:0x2ff -bdata:0x100.0x2ff -dhwstk_size:16 -beeprom:0.256 -fihx_coff >>> -S2 @M.lk >>>!E (57): Address out of range 65535 is larger than max address >>>4096 >>>C:\iccv7avr\bin\imakew.exe: Error code 1 >>>Done: there are error(s). Exit code: 1. Thu Mar 01 19:53:44 2007 > > // richard (This email is for mailing lists. To reach me directly, please > use richard at imagecraft.com) > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From richard-lists at imagecraft.com Thu Mar 1 20:16:44 2007 From: richard-lists at imagecraft.com (Richard) Date: Thu Mar 1 20:24:41 2007 Subject: 7.12A compiler was: Re: [Icc-avr] Problem compiling bootloader In-Reply-To: <000d01c75c77$a59e5830$0301a8c0@Sylvain> References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> <6.1.0.6.2.20070301184719.07917c00@192.168.100.42> <000d01c75c77$a59e5830$0301a8c0@Sylvain> Message-ID: <6.1.0.6.2.20070301201614.07891d18@192.168.100.42> http://www.dragonsgate.net/pub/BETAS/iccomavr.exe At 07:05 PM 3/1/2007, you wrote: >Hi Richard > > Your path is not good http://www.dragonsgate.net/pub/Betas/iccomavr.exe > >Sylvain > // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From richard-lists at imagecraft.com Fri Mar 2 01:15:33 2007 From: richard-lists at imagecraft.com (Richard) Date: Fri Mar 2 01:23:30 2007 Subject: 7.12A compiler was: Re: [Icc-avr] Problem compiling bootloader In-Reply-To: <6.1.0.6.2.20070301201614.07891d18@192.168.100.42> References: <07Feb26.154535cet.38958@gateway.pijnenburg.nl> <45E34881.8000801@virgin.net> <002901c75c69$a7bbc250$0301a8c0@Sylvain> <6.1.0.6.2.20070301184719.07917c00@192.168.100.42> <000d01c75c77$a59e5830$0301a8c0@Sylvain> <6.1.0.6.2.20070301201614.07891d18@192.168.100.42> Message-ID: <6.1.0.6.2.20070302011521.07974268@192.168.100.42> I dropped my brain in the middle of the Pacific on route home :-) I meant http://www.dragonsgate.net/pub/BETAS/ilinkavr.exe Hmm... in case you deleted your V7.12 iccomavr.exe, it's here: http://www.dragonsgate.net/pub/BETAS/iccomavr.exe At 08:16 PM 3/1/2007, Richard wrote: >http://www.dragonsgate.net/pub/BETAS/iccomavr.exe > >At 07:05 PM 3/1/2007, you wrote: >>Hi Richard >> >> Your path is not good http://www.dragonsgate.net/pub/Betas/iccomavr.exe >> >>Sylvain > >// richard (This email is for mailing lists. To reach me directly, please >use richard at imagecraft.com) >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From richard at imagecraft.com Fri Mar 2 21:18:45 2007 From: richard at imagecraft.com (Richard) Date: Fri Mar 2 21:26:38 2007 Subject: [Icc-avr] (no subject) Message-ID: <6.1.0.6.2.20070302183943.076c7438@192.168.100.42> 2007 is setting out to be an interesting year at ImageCraft. We will continue to enhance our existing products of course: - new 8 bit optimizations for AVR and M8C (PRO version) - support for new devices in the AVR, MSP430, ARM, and S12X families. Including extended addressing for 430X. In addition, we have decided on the following new projects: - Microchip PIC24 port. The PIC24 is a new 16 bit family from Microchip. It has many advantages that comes with being a Microchip device without some of the earlier architectural limitations. As PIC16 users upgrading to larger parts, the PIC24 is a natural step up. - Propeller C. Propeller is a unique device from http://www.parallax.com. 8 32-bit CPUs on one chip. Think "no interrupt." Propeller C gives us an opportunity to - ARM7 Educational Kits. We are producing a complete education kit bundle with board, compiler, debugger, and course materials for some large universities. I expect variants of this kit will be made to address different unverisities' needs. - More flexible dongle scheme. We sold over 500 dongles last year. I have ideas on making them more flexible. Anyway, my brain is still somewhere out in the Pacific Ocean. That's for now. Thank you for your support. // richard From sl at ecpower.dk Fri Mar 2 22:55:16 2007 From: sl at ecpower.dk (Steven Lose) Date: Fri Mar 2 23:08:13 2007 Subject: SV: [Icc-avr] (no subject) Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1655C8@seattle.ecpower.dk> HI Richard. Sounds god, can't wait to see what the 8 bit optimizations can do. ;o) Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -----Oprindelig meddelelse----- Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af Richard Sendt: 3. marts 2007 06:19 Til: icc-announce@imagecraft.com; icc-avr@imagecraft.com; icc-mot@imagecraft.com; icc-430@imagecraft.com; icc-arm@imagecraft.com Emne: [Icc-avr] (no subject) 2007 is setting out to be an interesting year at ImageCraft. We will continue to enhance our existing products of course: - new 8 bit optimizations for AVR and M8C (PRO version) - support for new devices in the AVR, MSP430, ARM, and S12X families. Including extended addressing for 430X. In addition, we have decided on the following new projects: - Microchip PIC24 port. The PIC24 is a new 16 bit family from Microchip. It has many advantages that comes with being a Microchip device without some of the earlier architectural limitations. As PIC16 users upgrading to larger parts, the PIC24 is a natural step up. - Propeller C. Propeller is a unique device from http://www.parallax.com. 8 32-bit CPUs on one chip. Think "no interrupt." Propeller C gives us an opportunity to - ARM7 Educational Kits. We are producing a complete education kit bundle with board, compiler, debugger, and course materials for some large universities. I expect variants of this kit will be made to address different unverisities' needs. - More flexible dongle scheme. We sold over 500 dongles last year. I have ideas on making them more flexible. Anyway, my brain is still somewhere out in the Pacific Ocean. That's for now. Thank you for your support. // richard _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From scinthia_245 at rediffmail.com Sat Mar 3 03:38:07 2007 From: scinthia_245 at rediffmail.com (cyn thia) Date: Sat Mar 3 03:49:28 2007 Subject: [Icc-avr] (no subject) Message-ID: <20070303113807.12328.qmail@webmail103.rediffmail.com> ? pls unsubscribe my account -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070303/e421ff17/attachment.html From sbissonnette at microsyl.com Mon Mar 5 13:54:30 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Mon Mar 5 14:02:39 2007 Subject: [Icc-avr] Is it possible to do this? References: Message-ID: <000701c75f70$da89ac60$0301a8c0@Sylvain> Hi, I'm not a #define expert, I want to know if it's possible to do this? MINDELAY (x - 0.148285449) / 0.016682113 x can be from 1 to 20 The result will always between 0 and 2000 (int) Thanks Sylvain Bissonnette From richard at imagecraft.com Mon Mar 5 18:12:16 2007 From: richard at imagecraft.com (Richard) Date: Mon Mar 5 18:20:19 2007 Subject: [Icc-avr] V7.12A Beta0 Message-ID: <6.1.0.6.2.20070305180724.05298990@192.168.100.42> V7.12A IDE - The starting address for the 644P was incorrect (the only current "P" device with more interrupt vectors than the corresponding non-P devices. - For ISP with STK500, add a box for "No Erase." Use only if you pre-erase the chip. Linker - bootloader build for < 64K devices were broken WRT -e: switch added in 7.10B Library - added the missing cstrpbrk and a new cstrtok http://www.imagecraft.com/pub/iccv7avr_v712a_beta0.exe // richard On-line orders, support, and listservers available on web site. [ For technical support on ImageCraft products, please include all previous replies in your msgs. ] From r.rohde at indas.de Tue Mar 6 04:09:54 2007 From: r.rohde at indas.de (Roman Rohde) Date: Tue Mar 6 04:18:40 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <000701c75f70$da89ac60$0301a8c0@Sylvain> References: <000701c75f70$da89ac60$0301a8c0@Sylvain> Message-ID: <45ED5A12.7060605@indas.de> it should be possible, but try to avoid "/" and set the extra double brackets in the formula. #define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 Roman Sylvain Bissonnette schrieb: > Hi, > > I'm not a #define expert, I want to know if it's possible to do this? > > MINDELAY (x - 0.148285449) / 0.016682113 > x can be from 1 to 20 > > The result will always between 0 and 2000 (int) > > Thanks > Sylvain Bissonnette > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From j_baraclough at zetnet.co.uk Tue Mar 6 07:38:52 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Tue Mar 6 07:47:07 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <45ED5A12.7060605@indas.de> References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> Message-ID: What Roman suggests will certainly work but why do you want to do it that way? Five minutes work with an Excel spreadsheet gave me the following results: const float MinDelay[20] = { 51.0555557920, 111.0000004796, 170.9444451671, 230.8888898547, 290.8333345422, 350.7777792298, 410.7222239173, 470.6666686049, 530.6111132924, 590.5555579800, 650.5000026675, 710.4444473551, 770.3888920426, 830.3333367302, 890.2777814177, 950.2222261053, 1010.1666707928, 1070.1111154804, 1130.0555601680, 1190.0000048555 }; OK that's only to ten decimal places, but with 8-bits it should be good enough. All the best for now, John At 12:09 06/03/2007, you wrote: >it should be possible, but try to avoid "/" and set the extra double >brackets in the formula. > >#define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 > >Roman > >Sylvain Bissonnette schrieb: >>Hi, >> >> I'm not a #define expert, I want to know if it's possible to do this? >> >>MINDELAY (x - 0.148285449) / 0.016682113 >>x can be from 1 to 20 >> >>The result will always between 0 and 2000 (int) >> >>Thanks >>Sylvain Bissonnette >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070306/3c4a2b7e/attachment.html From sbissonnette at microsyl.com Tue Mar 6 08:07:39 2007 From: sbissonnette at microsyl.com (sbissonnette@microsyl.com) Date: Tue Mar 6 08:15:45 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> Message-ID: <34998.199.22.57.2.1173197259.squirrel@www.microsyl.com> Hi, The reason is that my value will be from 1 to 20 but with decimal it's the xtal speed of my MCU so it can be 3.579545 Thanks for all Sylvain > What Roman suggests will certainly work but why do you want to do it > that way? Five minutes work with an Excel spreadsheet gave me the > following results: > > const float MinDelay[20] = > { > 51.0555557920, 111.0000004796, 170.9444451671, 230.8888898547, > 290.8333345422, 350.7777792298, 410.7222239173, 470.6666686049, > 530.6111132924, 590.5555579800, 650.5000026675, 710.4444473551, > 770.3888920426, 830.3333367302, 890.2777814177, 950.2222261053, > 1010.1666707928, 1070.1111154804, 1130.0555601680, 1190.0000048555 > }; > > OK that's only to ten decimal places, but with 8-bits it should be good > enough. > > All the best for now, > John > > > At 12:09 06/03/2007, you wrote: >>it should be possible, but try to avoid "/" and set the extra double >>brackets in the formula. >> >>#define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 >> >>Roman >> >>Sylvain Bissonnette schrieb: >>>Hi, >>> >>> I'm not a #define expert, I want to know if it's possible to do >>> this? >>> >>>MINDELAY (x - 0.148285449) / 0.016682113 >>>x can be from 1 to 20 >>> >>>The result will always between 0 and 2000 (int) >>> >>>Thanks >>>Sylvain Bissonnette >>> >>>_______________________________________________ >>>Icc-avr mailing list >>>Icc-avr@imagecraft.com >>>http://dragonsgate.net/mailman/listinfo/icc-avr >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From sbissonnette at microsyl.com Tue Mar 6 08:10:33 2007 From: sbissonnette at microsyl.com (sbissonnette@microsyl.com) Date: Tue Mar 6 08:18:39 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <45ED5A12.7060605@indas.de> References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> Message-ID: <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> Hi, could you told me why #define MINDELAY(x) "what () do?" and is it the same for ( ((x)) - 0.148285449) * 59.94444469 ^^^ Thanks Sylvain From j_baraclough at zetnet.co.uk Tue Mar 6 09:59:44 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Tue Mar 6 10:07:59 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> Message-ID: Hi Sylvain, Parentheses are required to keep the macro arguments together and there can be no space between the macro name and the opening parenthesis. As an example, consider the macro: #define SQUARE(x) x*x When invoked as: y = SQUARE(z + 1); the resulting calculation after preprocessor substitution will be : y = z*z + 1; Because of operator precedence, that does not return the correct value, which should be: y = (z + 1)*(z + 1); Writing the macro as: #define SQUARE(x) (x*x) will make the correct substitution. The parentheses are even more important when the macro has multiple arguments, as in: #define MAX(a, b) ((a) > (b) ? (a) : (b)) which when invoked as: y = MAX(p+q, r+s); will result in: y = ((p+q) > (r+s) ? (p+q) : (r+s)); This is a good general reference for the C language: http://www.its.strath.ac.uk/courses/c/ and more specific detail can be found here: http://www.its.strath.ac.uk/courses/c/subsection3_13_2.html#SECTION00013200000000000000 Hope that helps. All the best for now, John At 16:10 06/03/2007, you wrote: >Hi, > > could you told me why #define MINDELAY(x) "what () do?" >and is it the same for ( ((x)) - 0.148285449) * 59.94444469 > ^^^ > >Thanks >Sylvain > > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070306/918aa1f3/attachment.html From james.hatley at comcast.net Tue Mar 6 08:40:28 2007 From: james.hatley at comcast.net (James Hatley) Date: Tue Mar 6 12:33:15 2007 Subject: [Icc-avr] Is it possible to do this? References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <34998.199.22.57.2.1173197259.squirrel@www.microsyl.com> Message-ID: <001301c7600e$3222d260$6901a8c0@hsd1.wa.comcast.net> I think you want and integer result so... How about using 60*x-9 rather than the floating point? Jim ----- Original Message ----- From: To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Tuesday, March 06, 2007 8:07 AM Subject: Re: [Icc-avr] Is it possible to do this? > Hi, > > The reason is that my value will be from 1 to 20 but with decimal > it's the xtal speed of my MCU so it can be 3.579545 > > Thanks for all > Sylvain > > > What Roman suggests will certainly work but why do you want to do it > > that way? Five minutes work with an Excel spreadsheet gave me the > > following results: > > > > const float MinDelay[20] = > > { > > 51.0555557920, 111.0000004796, 170.9444451671, 230.8888898547, > > 290.8333345422, 350.7777792298, 410.7222239173, 470.6666686049, > > 530.6111132924, 590.5555579800, 650.5000026675, 710.4444473551, > > 770.3888920426, 830.3333367302, 890.2777814177, 950.2222261053, > > 1010.1666707928, 1070.1111154804, 1130.0555601680, 1190.0000048555 > > }; > > > > OK that's only to ten decimal places, but with 8-bits it should be good > > enough. > > > > All the best for now, > > John > > > > > > At 12:09 06/03/2007, you wrote: > >>it should be possible, but try to avoid "/" and set the extra double > >>brackets in the formula. > >> > >>#define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 > >> > >>Roman > >> > >>Sylvain Bissonnette schrieb: > >>>Hi, > >>> > >>> I'm not a #define expert, I want to know if it's possible to do > >>> this? > >>> > >>>MINDELAY (x - 0.148285449) / 0.016682113 > >>>x can be from 1 to 20 > >>> > >>>The result will always between 0 and 2000 (int) > >>> > >>>Thanks > >>>Sylvain Bissonnette > >>> > >>>_______________________________________________ > >>>Icc-avr mailing list > >>>Icc-avr@imagecraft.com > >>>http://dragonsgate.net/mailman/listinfo/icc-avr > >> > >>_______________________________________________ > >>Icc-avr mailing list > >>Icc-avr@imagecraft.com > >>http://dragonsgate.net/mailman/listinfo/icc-avr > >> > > _______________________________________________ > > Icc-avr mailing list > > Icc-avr@imagecraft.com > > http://dragonsgate.net/mailman/listinfo/icc-avr > > > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From sbissonnette at microsyl.com Tue Mar 6 13:24:03 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Tue Mar 6 13:32:14 2007 Subject: [Icc-avr] Is it possible to do this? References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> Message-ID: <000601c76035$c392cee0$0301a8c0@Sylvain> Hi, I try it, but It's don't work, with calculator it's work I got the good value, but not with ICC. Any idea? > it should be possible, but try to avoid "/" and set the extra double > brackets in the formula. > > #define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 Thanks Sylvain From johan at edab.nu Wed Mar 7 00:03:36 2007 From: johan at edab.nu (johan@edab.nu) Date: Wed Mar 7 00:12:25 2007 Subject: [Icc-avr] Is it possible to do this? Message-ID: <200703070803.l2783aCT001515@gigamail.giganet.se> If you use that expression in the following way: y = (int)MINDELAY(x); you're gonna get the wrong result - you need brackets around the whole statement otherwise the cast to (int) will cast the first part for the expression before multiplying with 59.94... That's why the expression should look like this: #define MINDELAY(x) ((x-0.148285449) * 59.94444469) Likewise you should always write brackets around defines that consist of an expression, like: #define ADD_ONE(x) (x+1) There should be no problem however (as someone claimed) to write a define and use spaces between the terms when using it, if the define is correctly written. This is an example that works in all cases: #define SQUARE(x) ((x)*(x)) so it'll be possible to do y = SQUARE(x + 1); I see no use for the double brackets, what's up with those anyway? regards Johan Wallstr?m Elektronik Design AB On 2007-03-06 Sylvain Bissonnette wrote: Hi, > > I try it, but It's don't work, with calculator it's work I got the good >value, but not with ICC. Any idea? > >> it should be possible, but try to avoid "/" and set the extra double >> brackets in the formula. >> >> #define MINDELAY(x) ( ((x)) - 0.148285449) * 59.94444469 > >Thanks >Sylvain > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > > From schaefer at mabel.info Wed Mar 7 02:09:46 2007 From: schaefer at mabel.info (=?ISO-8859-15?Q?Thomas_Sch=E4fer?=) Date: Wed Mar 7 02:18:08 2007 Subject: [Icc-avr] Problems w/ watchdog ATM2561 Message-ID: <45EE8F6A.2080907@mabel.info> Hello, I'm struggling with the watchdog in a ATM2561. After setting up the entire system in Main(), I activate the watchdog with /// \brief enables the watchdog timer. /// \remarks Mode: System Reset /// \remarks Timeout: Twdt = 8s /// \warning After execution the WDR() macro has to be called repeatedly within Twdt void watchdog_enable(void) { CLI(); WDR(); WDTCSR |= (1< References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> Message-ID: Am Tue, 06 Mar 2007 18:59:44 +0100 schrieb John Baraclough : > #define SQUARE(x) x*x > When invoked as: > y = SQUARE(z + 1); > the resulting calculation after preprocessor substitution will be : > y = z*z + 1; no it will be y = z + 1*z + 1 From JonODonnell at moonlightconsulting.us Wed Mar 7 04:02:13 2007 From: JonODonnell at moonlightconsulting.us (Jon O'Donnell) Date: Wed Mar 7 04:08:24 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: References: <000701c75f70$da89ac60$0301a8c0@Sylvain><45ED5A12.7060605@indas.de><46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> Message-ID: <003301c760b0$72659900$0201a8c0@ctc.parker.com> The most dangerous part of this form of macros is y = SQUARE(z++); becomes y = ((z++)*(z++)); This does not have the expected result no matter what combination of () are used. For this reason I avoid and calculation macros which make more than one reference to an arg. Jon From rohde at aragon-interactive.de Wed Mar 7 05:44:11 2007 From: rohde at aragon-interactive.de (Roman Rohde) Date: Wed Mar 7 05:52:21 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <003301c760b0$72659900$0201a8c0@ctc.parker.com> References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> <003301c760b0$72659900$0201a8c0@ctc.parker.com> Message-ID: Am Wed, 07 Mar 2007 13:02:13 +0100 schrieb Jon O'Donnell : > The most dangerous part of this form of macros is > y = SQUARE(z++); > becomes > y = ((z++)*(z++)); Theres a simple workaroud: DON'T DO THAT! never usr ++ or -- in a macro argument or function call. just write y = SQUARE(z); z++; From JonODonnell at moonlightconsulting.us Wed Mar 7 08:37:47 2007 From: JonODonnell at moonlightconsulting.us (JonODonnell@moonlightconsulting.us) Date: Wed Mar 7 08:46:06 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> <003301c760b0$72659900$0201a8c0@ctc.parker.com> Message-ID: <1173285467.45eeea5bec37a@webmail.moonlightconsulting.us> Function calls as arguments can be OK. My solution is "Never write a macro which has side-effects which would differ from a function." Consequently, I end up with macros like this #define Test(x) do { u8 v = (x); ....... } while (0) This make the the utilization of Test the same as an inline function. This does not work for functions which return values. Just personal preference. Jon Quoting Roman Rohde : > Am Wed, 07 Mar 2007 13:02:13 +0100 schrieb Jon O'Donnell > : > > > The most dangerous part of this form of macros is > > y = SQUARE(z++); > > becomes > > y = ((z++)*(z++)); > > Theres a simple workaroud: DON'T DO THAT! > never usr ++ or -- in a macro argument or function call. > > just write > y = SQUARE(z); > z++; > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > From j_baraclough at zetnet.co.uk Wed Mar 7 13:25:32 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Wed Mar 7 13:33:49 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: References: <000701c75f70$da89ac60$0301a8c0@Sylvain> <45ED5A12.7060605@indas.de> <46854.199.22.57.2.1173197433.squirrel@www.microsyl.com> Message-ID: Compile the following code and look at the result in Studio. I think you will be surprised. #define SQUARE1(x) x * x #define SQUARE2(x) (x) * (x) #define SQUARE3(x) (x * x) #define SQUARE4(x) ((x) * (x)) unsigned int y, z; void main(void) { y = 3; z = SQUARE1(y + 1); y = z; y = 3; z = SQUARE2(y + 1); y = z; y = 3; z = SQUARE3(y + 1); y = z; y = 3; z = SQUARE4(y + 1); y = z; while(1) ; } It's also interesting to look at the listing file. John At 10:44 07/03/2007, you wrote: >Am Tue, 06 Mar 2007 18:59:44 +0100 schrieb John Baraclough >: > >>#define SQUARE(x) x*x >>When invoked as: >>y = SQUARE(z + 1); >>the resulting calculation after preprocessor substitution will be : >>y = z*z + 1; >no it will be >y = z + 1*z + 1 > > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > From sbissonnette at microsyl.com Wed Mar 7 16:46:50 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Wed Mar 7 16:55:03 2007 Subject: [Icc-avr] Is it possible to do this? References: <200703070803.l2783aCT001515@gigamail.giganet.se> Message-ID: <003201c7611b$42ab91e0$0301a8c0@Sylvain> Hi, Thanks for all the good informations. Now it's almost work with #define MINDELAY(x) ((x-0.148285449) * 59.94444469) But it's look like the computation don't take all the decimal because my result is a little bit offset compare the the same calculation on my calculator. Any input are again welcome Sylvain Bissonnette From MDipperstein at CalAmp.com Wed Mar 7 17:25:26 2007 From: MDipperstein at CalAmp.com (Michael Dipperstein) Date: Wed Mar 7 17:33:35 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: Message-ID: When I'm not sure how a macro will be expanded, I look at the output of the C Preprocessor. ICC's preprocessor is icppw.exe. In theory it shouldn't expand macros any different than any other preprocessor, but that's just theory. -Mike -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of John Baraclough Sent: Wednesday, March 07, 2007 1:26 PM To: rohde@aragon-interactive.de; Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Subject: Re: [Icc-avr] Is it possible to do this? Compile the following code and look at the result in Studio. I think you will be surprised. #define SQUARE1(x) x * x #define SQUARE2(x) (x) * (x) #define SQUARE3(x) (x * x) #define SQUARE4(x) ((x) * (x)) unsigned int y, z; void main(void) { y = 3; z = SQUARE1(y + 1); y = z; y = 3; z = SQUARE2(y + 1); y = z; y = 3; z = SQUARE3(y + 1); y = z; y = 3; z = SQUARE4(y + 1); y = z; while(1) ; } It's also interesting to look at the listing file. John At 10:44 07/03/2007, you wrote: >Am Tue, 06 Mar 2007 18:59:44 +0100 schrieb John Baraclough >: > >>#define SQUARE(x) x*x >>When invoked as: >>y = SQUARE(z + 1); >>the resulting calculation after preprocessor substitution will be : >>y = z*z + 1; >no it will be >y = z + 1*z + 1 > > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From DRaymond at Bankspower.com Wed Mar 7 17:32:09 2007 From: DRaymond at Bankspower.com (David Raymond) Date: Wed Mar 7 17:40:24 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <003201c7611b$42ab91e0$0301a8c0@Sylvain> Message-ID: <0E755D4F91B6D344B39791054F52A2A901220856@gbexchange.bankspower.local> If you are expecting the AVR to calculate to this accuracy using floating point and Imagecraft, it is not going to happen. I never use floating point, but I have read that you only get 4 decimal points of accuracy using singles. If you are looking for an int result you might try scaling your equation to much higher numbers. Is your input always a float? Example using float: #define MINDELAY(x) (((6.74375 * (x))- 1.0) * 8.88889) If you allow the preprocessor to do the calculations, you may gain accuracy. Richard will know if the preprocessor uses the full capability of the underlying computer to do the calculations. You can try this by defining another term using MINDELAY(x) cast as an int. If your input can be a 32 bit value (unsigned long), you can scale this even higher. Example using long: #define MINDELAY(x) (unsigned int)((((1079L * (x))- 160) * 12800) / 9) Dave Raymond Software Engineer Gale Banks Engineering Ph (626) 969-9600 x3301 Fx (626) 334-2376 Visit us on the Web: www.bankspower.com E-mail: draymond@bankspower.com -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com]On Behalf Of Sylvain Bissonnette Sent: Wednesday, March 07, 2007 4:47 PM To: Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribetoicc-announce if you are a member of this. Subject: Re: [Icc-avr] Is it possible to do this? Hi, Thanks for all the good informations. Now it's almost work with #define MINDELAY(x) ((x-0.148285449) * 59.94444469) But it's look like the computation don't take all the decimal because my result is a little bit offset compare the the same calculation on my calculator. Any input are again welcome Sylvain Bissonnette _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From sbissonnette at microsyl.com Wed Mar 7 18:56:04 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Wed Mar 7 19:04:18 2007 Subject: [Icc-avr] Is it possible to do this? References: <0E755D4F91B6D344B39791054F52A2A901220856@gbexchange.bankspower.local> Message-ID: <000801c7612d$5054b620$0301a8c0@Sylvain> Hi, I'm not shure I understand, the way I think it's work the #define calculation is not made by the ICC floating point? The calculation is done by the PC before the compilation is done. so imho it can be the AVR floating point who give me my error. Thanks again Sylvain Bissonnette ----- Original Message ----- From: "David Raymond" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this." Sent: Wednesday, March 07, 2007 8:32 PM Subject: RE: [Icc-avr] Is it possible to do this? > If you are expecting the AVR to calculate to this accuracy using floating > point and Imagecraft, it is not going to happen. I never use floating > point, but I have read that you only get 4 decimal points of accuracy > using singles. If you are looking for an int result you might try scaling > your equation to much higher numbers. Is your input always a float? > Example using float: > #define MINDELAY(x) (((6.74375 * (x))- 1.0) * 8.88889) > If you allow the preprocessor to do the calculations, you may gain > accuracy. Richard will know if the preprocessor uses the full capability > of the underlying computer to do the calculations. You can try this by > defining another term using MINDELAY(x) cast as an int. > If your input can be a 32 bit value (unsigned long), you can scale this > even higher. > Example using long: > #define MINDELAY(x) (unsigned int)((((1079L * (x))- 160) * 12800) / 9) > > Dave Raymond > Software Engineer > Gale Banks Engineering > Ph (626) 969-9600 x3301 > Fx (626) 334-2376 > Visit us on the Web: www.bankspower.com > E-mail: draymond@bankspower.com > > > > -----Original Message----- > From: icc-avr-bounces@imagecraft.com > [mailto:icc-avr-bounces@imagecraft.com]On Behalf Of Sylvain Bissonnette > Sent: Wednesday, March 07, 2007 4:47 PM > To: Discussion list for ICCAVR and ICCtiny Users. You do NOT > needtosubscribetoicc-announce if you are a member of this. > Subject: Re: [Icc-avr] Is it possible to do this? > > > Hi, > > Thanks for all the good informations. Now it's almost work with > #define MINDELAY(x) ((x-0.148285449) * 59.94444469) > > But it's look like the computation don't take all the decimal because my > result is a little bit > offset compare the the same calculation on my calculator. > > Any input are again welcome > Sylvain Bissonnette > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From richard-lists at imagecraft.com Wed Mar 7 22:42:36 2007 From: richard-lists at imagecraft.com (Richard) Date: Wed Mar 7 22:50:44 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <000801c7612d$5054b620$0301a8c0@Sylvain> References: <0E755D4F91B6D344B39791054F52A2A901220856@gbexchange.bankspower.local> <000801c7612d$5054b620$0301a8c0@Sylvain> Message-ID: <6.1.0.6.2.20070307223655.07842410@192.168.100.42> Sorry I haven't followed all parts of the thread carefully, but let me summarize some salient points: - the C Preprocessor is does textual substitution and nothing more (for the purpose of macro expansion). Hence the usual recommendation of using () inside the definition to minimize unintended results. This does not address the potential danger of calling a function like macro with expressions with side effect such as a++, as noted by some posters. - C does not say that constant floating point expressions have to be done at compile time. In fact, BECAUSE the compile time floating point (FP) constant folding will probably give different results than runtime evaluation (accuracy of PC math vs. 8 bit micro math), the compiler usually does not fold FP constants unless it needs to. - Single precision gives ~7+ decimal digits of meaning values. - Any FP calculation done by the compiler uses the native compiler behaviors, which is most likely in the native 80 bits intermediate format. At 06:56 PM 3/7/2007, Sylvain Bissonnette wrote: >Hi, > > I'm not shure I understand, the way I think it's work the #define > calculation is not made >by the ICC floating point? The calculation is done by the PC before the >compilation is done. >so imho it can be the AVR floating point who give me my error. > >Thanks again >Sylvain Bissonnette // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From j_baraclough at zetnet.co.uk Thu Mar 8 02:03:11 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Mar 8 02:11:27 2007 Subject: [Icc-avr] Is it possible to do this? In-Reply-To: <000801c7612d$5054b620$0301a8c0@Sylvain> References: <0E755D4F91B6D344B39791054F52A2A901220856@gbexchange.bankspower.local> <000801c7612d$5054b620$0301a8c0@Sylvain> Message-ID: Hi Sylvain, When something isn't working correctly, it's always useful to look at the listing output to see what is happening. Compiling this little snippet of code: #define MINDELAY1(x) ((x-0.148285449) * 59.94444469) #define MINDELAY2(x) (((6.74375 * (x))- 1.0) * 8.88889) float f, g; void main(void) { f = MINDELAY1(5); g = f; g = 5.0; f = MINDELAY1(g); g = f; f = MINDELAY2(5); g = f; g = 5.0; f = MINDELAY2(g); g = f; while(1) ; } Gives this output: . . . (0021) void main(void) (0022) { (0023) f = MINDELAY1(5); _main: 97 EE08 LDI R16,0xE8 98 E010 LDI R17,0 99 940E 0141 CALL elpm32 9B 9310 0205 STS f+1,R17 9D 9300 0204 STS f,R16 9F 9330 0207 STS f+3,R19 A1 9320 0206 STS f+2,R18 (0024) g = f; A3 0118 MOVW R2,R16 A4 0129 MOVW R4,R18 A5 9230 0201 STS g+1,R3 A7 9220 0200 STS g,R2 A9 9250 0203 STS g+3,R5 AB 9240 0202 STS g+2,R4 (0025) g = 5.0; AD EE04 LDI R16,0xE4 AE E010 LDI R17,0 AF 940E 0141 CALL elpm32 B1 9310 0201 STS g+1,R17 B3 9300 0200 STS g,R16 B5 9330 0203 STS g+3,R19 B7 9320 0202 STS g+2,R18 (0026) f = MINDELAY1(g); B9 EE00 LDI R16,0xE0 BA E010 LDI R17,0 BB 940E 0141 CALL elpm32 BD 0118 MOVW R2,R16 BE 0129 MOVW R4,R18 BF 9080 0202 LDS R8,g+2 C1 9090 0203 LDS R9,g+3 C3 9060 0200 LDS R6,g C5 9070 0201 LDS R7,g+1 C7 ED0C LDI R16,0xDC C8 E010 LDI R17,0 C9 940E 0141 CALL elpm32 CB 933A ST R19,-Y CC 932A ST R18,-Y CD 931A ST R17,-Y CE 930A ST R16,-Y CF 0183 MOVW R16,R6 D0 0194 MOVW R18,R8 D1 940E 01C6 CALL fpsub2x D3 0181 MOVW R16,R2 D4 0192 MOVW R18,R4 D5 940E 02B6 CALL fpmule2 D7 9310 0205 STS f+1,R17 D9 9300 0204 STS f,R16 DB 9330 0207 STS f+3,R19 DD 9320 0206 STS f+2,R18 . . . As you can see from that, in the first invocation of MINDELAY1(), the host computer is doing the hard work and the code is simply recovering a stored value from Flash, however in the second it needs to do the calculation as the value is not known at compile time. Thus the second result is not the same as the first. Having said that, when run through AvrStudio, the first invocation returns 290.83334 and the second 290.83331, which is only a 1.03e-5 percentage error. A quick look at your own listing file will reveal how the compiler is treating your case. All the best for now, John At 02:56 08/03/2007, you wrote: >Hi, > > I'm not shure I understand, the way I think it's work the > #define calculation is not made >by the ICC floating point? The calculation is done by the PC before >the compilation is done. >so imho it can be the AVR floating point who give me my error. > >Thanks again >Sylvain Bissonnette > >----- Original Message ----- From: "David Raymond" >To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT >needtosubscribeto icc-announce if you are a member of this." > >Sent: Wednesday, March 07, 2007 8:32 PM >Subject: RE: [Icc-avr] Is it possible to do this? > > >>If you are expecting the AVR to calculate to this accuracy using >>floating point and Imagecraft, it is not going to happen. I never >>use floating point, but I have read that you only get 4 decimal >>points of accuracy using singles. If you are looking for an int >>result you might try scaling your equation to much higher numbers. >>Is your input always a float? >>Example using float: >>#define MINDELAY(x) (((6.74375 * (x))- 1.0) * 8.88889) >>If you allow the preprocessor to do the calculations, you may gain >>accuracy. Richard will know if the preprocessor uses the full >>capability of the underlying computer to do the calculations. You >>can try this by defining another term using MINDELAY(x) cast as an int. >>If your input can be a 32 bit value (unsigned long), you can scale >>this even higher. >>Example using long: >>#define MINDELAY(x) (unsigned int)((((1079L * (x))- 160) * 12800) / 9) >> >>Dave Raymond >>Software Engineer >>Gale Banks Engineering >>Ph (626) 969-9600 x3301 >>Fx (626) 334-2376 >>Visit us on the Web: www.bankspower.com >>E-mail: draymond@bankspower.com >> >> >> >>-----Original Message----- >>From: icc-avr-bounces@imagecraft.com >>[mailto:icc-avr-bounces@imagecraft.com]On Behalf Of Sylvain Bissonnette >>Sent: Wednesday, March 07, 2007 4:47 PM >>To: Discussion list for ICCAVR and ICCtiny Users. You do NOT >>needtosubscribetoicc-announce if you are a member of this. >>Subject: Re: [Icc-avr] Is it possible to do this? >> >> >>Hi, >> >> Thanks for all the good informations. Now it's almost work with >>#define MINDELAY(x) ((x-0.148285449) * 59.94444469) >> >>But it's look like the computation don't take all the decimal because my >>result is a little bit >>offset compare the the same calculation on my calculator. >> >>Any input are again welcome >>Sylvain Bissonnette >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070308/bef60d96/attachment-0001.html From sbissonnette at microsyl.com Thu Mar 8 17:30:09 2007 From: sbissonnette at microsyl.com (Sylvain Bissonnette) Date: Thu Mar 8 17:38:23 2007 Subject: [Icc-avr] Is it possible to do this? References: <0E755D4F91B6D344B39791054F52A2A901220856@gbexchange.bankspower.local> <000801c7612d$5054b620$0301a8c0@Sylvain> <6.1.0.6.2.20070307223655.07842410@192.168.100.42> Message-ID: <001b01c761ea$79b476a0$0301a8c0@Sylvain> Hi, I what to thanks all of you who contribuate on this topic, now I'm fix on what #define does for real Yours truly Sylvain Bissonnette ----- Original Message ----- From: "Richard" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." ; "Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this." Sent: Thursday, March 08, 2007 1:42 AM Subject: Re: [Icc-avr] Is it possible to do this? > Sorry I haven't followed all parts of the thread carefully, but let me > summarize some salient points: > > - the C Preprocessor is does textual substitution and nothing more (for > the purpose of macro expansion). Hence the usual recommendation of using > () inside the definition to minimize unintended results. This does not > address the potential danger of calling a function like macro with > expressions with side effect such as a++, as noted by some posters. > > - C does not say that constant floating point expressions have to be done > at compile time. In fact, BECAUSE the compile time floating point (FP) > constant folding will probably give different results than runtime > evaluation (accuracy of PC math vs. 8 bit micro math), the compiler > usually does not fold FP constants unless it needs to. > > - Single precision gives ~7+ decimal digits of meaning values. > > - Any FP calculation done by the compiler uses the native compiler > behaviors, which is most likely in the native 80 bits intermediate format. > > At 06:56 PM 3/7/2007, Sylvain Bissonnette wrote: >>Hi, >> >> I'm not shure I understand, the way I think it's work the #define >> calculation is not made >>by the ICC floating point? The calculation is done by the PC before the >>compilation is done. >>so imho it can be the AVR floating point who give me my error. >> >>Thanks again >>Sylvain Bissonnette > > // richard (This email is for mailing lists. To reach me directly, please > use richard at imagecraft.com) > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From Svenn at symetrics.no Fri Mar 9 00:39:30 2007 From: Svenn at symetrics.no (=?iso-8859-1?Q?Svenn_Dahlstr=F8m?=) Date: Fri Mar 9 00:47:43 2007 Subject: SV: [Icc-avr] Problems w/ watchdog ATM2561 Message-ID: <23CAB4A1878E854994AB398BC4CF5B0E034F6B@SERVER.symetrics.local> Hi Thomas I had the same problem. Found out, if I disable the watchdog before setting it up and enable it, then it worked fine... //Disable watchdog reset WDR(); MCUSR &= ~(1< > Hello, > > I'm struggling with the watchdog in a ATM2561. > After setting up the entire system in Main(), I activate the watchdog with > > /// \brief enables the watchdog timer. > /// \remarks Mode: System Reset > /// \remarks Timeout: Twdt = 8s > /// \warning After execution the WDR() macro has to be called repeatedly > within Twdt > void watchdog_enable(void) > { > CLI(); > WDR(); > WDTCSR |= (1< WDTCSR = (1< SEI(); > } > > right before I enter the main loop. As long as I issue WDR's inside the > main loop, everything works fine. Now I tried to test the watchdog > functionality by commenting out the WDR macro, awaiting a system reset > 8s after entering the main loop. But the system seems just to stop and > remain in an undefined state. > > Any hints? > > regards, > Thomas > > PS: I'm using V7.12 Professional. > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > From benra at imt.liu.se Fri Mar 9 02:59:31 2007 From: benra at imt.liu.se (Bengt Ragnemalm) Date: Fri Mar 9 03:40:15 2007 Subject: SV: [Icc-avr] Problems w/ watchdog ATM2561 In-Reply-To: <23CAB4A1878E854994AB398BC4CF5B0E034F6B@SERVER.symetrics.local> References: <23CAB4A1878E854994AB398BC4CF5B0E034F6B@SERVER.symetrics.local> Message-ID: <011a01c7623a$043c3bb0$b160ec82@Shagrat> I think the problem is that if you do a lot of things before setting up the watchdog, you have no idea of how long the watchdog prescaler and counter have counted with a potential risk of getting a reset imediately. What is the normal behaviour for interrupt flags? Will the flag always get set but nothing happened if the interrupt are off or is the flag not set at all? I think it is the first. And if you have an interrupt flag set and after that, enable the interrupt, is the normal behaviour that you in that case trigger the interrupt immediately? Best regards, Bengt > -----Ursprungligt meddelande----- > Fr?n: icc-avr-bounces@imagecraft.com [mailto:icc-avr- > bounces@imagecraft.com] F?r Svenn Dahlstr?m > Skickat: den 9 mars 2007 09:40 > Till: Discussion list for ICCAVR and ICCtiny Users. You do NOT > needtosubscribeto icc-announce if you are a member of this. > ?mne: SV: [Icc-avr] Problems w/ watchdog ATM2561 > > Hi Thomas > > I had the same problem. > Found out, if I disable the watchdog before setting it up and enable it, > then it worked fine... > > //Disable watchdog reset > WDR(); > MCUSR &= ~(1< WDTCSR = (1< WDTCSR = 0; //all > zero, Turn off WDT > > Svenn :) > > > > > Hello, > > > > I'm struggling with the watchdog in a ATM2561. > > After setting up the entire system in Main(), I activate the watchdog > with > > > > /// \brief enables the watchdog timer. > > /// \remarks Mode: System Reset > > /// \remarks Timeout: Twdt = 8s > > /// \warning After execution the WDR() macro has to be called repeatedly > > within Twdt > > void watchdog_enable(void) > > { > > CLI(); > > WDR(); > > WDTCSR |= (1< > WDTCSR = (1< > SEI(); > > } > > > > right before I enter the main loop. As long as I issue WDR's inside the > > main loop, everything works fine. Now I tried to test the watchdog > > functionality by commenting out the WDR macro, awaiting a system reset > > 8s after entering the main loop. But the system seems just to stop and > > remain in an undefined state. > > > > Any hints? > > > > regards, > > Thomas > > > > PS: I'm using V7.12 Professional. > > > > _______________________________________________ > > Icc-avr mailing list > > Icc-avr@imagecraft.com > > http://dragonsgate.net/mailman/listinfo/icc-avr > > > > > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr From graham at altongate.co.uk Fri Mar 9 06:53:14 2007 From: graham at altongate.co.uk (Graham Whyte) Date: Fri Mar 9 07:22:10 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: If I have a switch statement with multiple cases like int a; a=1; Switch (a) { case:1 case:2 do_something(); break; default: break; } Question: Does do_something() get executed if a=1 ? I suspect not but it will if a=2 I want it to execute if a=1 and if a=2 If I am correct, how do I get do_something() to execute for a=1 or a=2 without having separate case: statements ? Can I write case:(1 || 2) ? Sorry for the probably dumb question I have been writing C code for many years but surprisingly have never come across this Graham From Michael.Kremer at adc.com Fri Mar 9 07:35:27 2007 From: Michael.Kremer at adc.com (Kremer, Michael) Date: Fri Mar 9 07:43:43 2007 Subject: [Icc-avr] C question off topic Message-ID: <5792D2F8C9A6134BBB5363709C83B23701E5E5A1@mn01exch02.adc.com> Case statements always fall though to the next unless you explicitly place a break in the statement. So for a=1 do_something() will be run. Note: the ':' needs to be on the other side of the number switch(a) { case 1: case 2: do_something(); break; default: break; } -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Graham Whyte Sent: Friday, March 09, 2007 8:53 AM To: benra@imt.liu.se; Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this. Subject: [Icc-avr] C question off topic If I have a switch statement with multiple cases like int a; a=1; Switch (a) { case:1 case:2 do_something(); break; default: break; } Question: Does do_something() get executed if a=1 ? I suspect not but it will if a=2 I want it to execute if a=1 and if a=2 If I am correct, how do I get do_something() to execute for a=1 or a=2 without having separate case: statements ? Can I write case:(1 || 2) ? Sorry for the probably dumb question I have been writing C code for many years but surprisingly have never come across this Graham _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From sidprice at softtools.com Fri Mar 9 07:42:31 2007 From: sidprice at softtools.com (Sid Price) Date: Fri Mar 9 07:51:10 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: <007f01c76261$93912060$0200a8c0@SID004> Yes the code will execute since the "case:1" does not have a "break" statement the processor "falls through" to execute the code after "case:2". Sid. Sid Price Software Design http://www.softtools.com -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Graham Whyte Sent: Friday, March 09, 2007 7:53 AM To: benra@imt.liu.se; Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this. Subject: [Icc-avr] C question off topic If I have a switch statement with multiple cases like int a; a=1; Switch (a) { case:1 case:2 do_something(); break; default: break; } Question: Does do_something() get executed if a=1 ? I suspect not but it will if a=2 I want it to execute if a=1 and if a=2 If I am correct, how do I get do_something() to execute for a=1 or a=2 without having separate case: statements ? Can I write case:(1 || 2) ? Sorry for the probably dumb question I have been writing C code for many years but surprisingly have never come across this Graham _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From obparham at jpl.nasa.gov Fri Mar 9 07:49:51 2007 From: obparham at jpl.nasa.gov (Bruce Parham) Date: Fri Mar 9 07:58:07 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: Message-ID: <45F1821F.5060503@jpl.nasa.gov> Graham Whyte wrote: > If I have a switch statement with multiple cases like > > int a; > a=1; > Switch (a) > { > case:1 > case:2 > do_something(); > break; > > default: > break; > } > > Question: > Does do_something() get executed if a=1 ? > I suspect not but it will if a=2 > I want it to execute if a=1 and if a=2 > > If I am correct, how do I get do_something() to execute for a=1 or a=2 > without having separate case: statements ? > > Can I write case:(1 || 2) ? > > Sorry for the probably dumb question > I have been writing C code for many years but surprisingly have never come > across this > > Graham Hi Graham, The switch statement is a "computed goto" and the case phrase is a label so, if a is 1 or 2, the do_something() gets done. Bruce From j_baraclough at zetnet.co.uk Fri Mar 9 07:57:27 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Fri Mar 9 08:05:43 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: Hi Graham, Yes you can. It's probably just a typo in your message, but you have written the 'case' statements incorrectly. It should be: switch(a) { case 1: case 2: do_something(); break; default: do_anotherthing(); break; } You should be aware that multiple entry case statements are now deprecated (isn't that a wonderful word). They should not generate an error, but may well be non-portable. If you are in doubt about something, the first step is to look at the listing file and see what the compiler is making of your source. All the best for now, John At 14:53 09/03/2007, you wrote: >If I have a switch statement with multiple cases like > >int a; >a=1; >Switch (a) > { > case:1 > case:2 > do_something(); > break; > > default: > break; > } > >Question: >Does do_something() get executed if a=1 ? >I suspect not but it will if a=2 >I want it to execute if a=1 and if a=2 > >If I am correct, how do I get do_something() to execute for a=1 or a=2 >without having separate case: statements ? > >Can I write case:(1 || 2) ? > >Sorry for the probably dumb question >I have been writing C code for many years but surprisingly have never come >across this > >Graham > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070309/7a4aa2ee/attachment-0001.html From stephan.daub at sap.com Fri Mar 9 07:55:36 2007 From: stephan.daub at sap.com (Daub, Stephan) Date: Fri Mar 9 08:06:35 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: Hi Graham, >Question: >Does do_something() get executed if a=1 ? Answer: Yes; unless you break the case chain by using "break". // sample 1 switch (a) { case 1: { do_something_else(); //will beexecuted if a==1 break; } case 2: { do_something(); //will beexecuted if a==2 break; } default: // is useless in this case break; // is useless in this case } // sample 2 switch (a) { case 1: // will "fall through" to the next case... case 2: { do_something(); //will beexecuted if a==1 or a==2 break; } } // Sample 2 with (which is more readable in my opinion) // but it's creating more or less the same code if (a==1 || a==2) { do_something(); //will beexecuted if a==1 or a==2 }; Best, Stephan -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Graham Whyte Sent: Friday, March 09, 2007 3:53 PM To: benra@imt.liu.se; Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this. Subject: [Icc-avr] C question off topic If I have a switch statement with multiple cases like int a; a=1; Switch (a) { case:1 case:2 do_something(); break; default: break; } Question: Does do_something() get executed if a=1 ? I suspect not but it will if a=2 I want it to execute if a=1 and if a=2 If I am correct, how do I get do_something() to execute for a=1 or a=2 without having separate case: statements ? Can I write case:(1 || 2) ? Sorry for the probably dumb question I have been writing C code for many years but surprisingly have never come across this Graham _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From obparham at jpl.nasa.gov Fri Mar 9 08:14:59 2007 From: obparham at jpl.nasa.gov (Bruce Parham) Date: Fri Mar 9 08:23:14 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: Message-ID: <45F18803.6020408@jpl.nasa.gov> Graham Whyte wrote: > If I have a switch statement with multiple cases like > > int a; > a=1; > Switch (a) > { > case:1 > case:2 > do_something(); > break; > > default: > break; > } > > Question: > Does do_something() get executed if a=1 ? > I suspect not but it will if a=2 > I want it to execute if a=1 and if a=2 > > If I am correct, how do I get do_something() to execute for a=1 or a=2 > without having separate case: statements ? > > Can I write case:(1 || 2) ? > > Sorry for the probably dumb question > I have been writing C code for many years but surprisingly have never come > across this > > Graham > Also the case label should end with the colon: Switch (a) { case 1: case 2: do_something(); break; default: break; } The value between the case word and the colon can be any int type value so you can use chars or two char ints. The following example uses a switch to parse command line options: while(argc > 1) // handle command line arg's { switch(toupper(argv[1][0])) { case 'B': sscanf(argv[1]+1, "%d", &bits); break; case 'M': sscanf(argv[1]+1, "%d", &m); break; case 'N': sscanf(argv[1]+1, "%d", &n); break; case 'O': sscanf(argv[1]+1, "%s", name); break; case 'S': sscanf(argv[1]+1, "%d", &s); break; case 'P': sscanf(argv[1]+1, "%d", &gsize); break; case 'G': g = 0; break; default: fprintf(stderr, "Unknown Option: %s\n\n", argv[1]); exit(1); } --argc; ++argv; } HTH, Bruce From obparham at jpl.nasa.gov Fri Mar 9 09:48:58 2007 From: obparham at jpl.nasa.gov (Bruce Parham) Date: Fri Mar 9 09:57:10 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: <45F19E0A.9090000@jpl.nasa.gov> John Baraclough wrote: . . . > You should be aware that multiple entry case statements are now > deprecated (isn't that a wonderful word). They should not generate an > error, but may well be non-portable. . . . http://dictionary.reference.com/browse/deprecate Why? The Bible (K&R 2nd Ed.) pg 58 states: "Each case is labeled by one or more integer-valued constants or constant expressions. ..." If you change the rules now, you'll be breaking a lot of existing code. Bruce From j_baraclough at zetnet.co.uk Fri Mar 9 10:16:46 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Fri Mar 9 10:25:02 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: The other reason for choosing the 'if(){} else if(){} else{}' construct over 'switch(){}', is that there is a limited amount of code you can put between 'case:' statements. Sometimes a 'switch(){}' will generate an 'Out of range' (or something like that) error message, in which case an 'if()' is the only solution. All the best for now, John At 15:55 09/03/2007, you wrote: >Hi Graham, > > >Question: > >Does do_something() get executed if a=1 ? > >Answer: >Yes; unless you break the case chain by using "break". > >// sample 1 >switch (a) { > case 1: { > do_something_else(); //will beexecuted if a==1 > > break; > } > case 2: { > do_something(); //will beexecuted if a==2 > break; > } > > default: // is useless in this case > break; // is useless in this case >} > >// sample 2 >switch (a) { > case 1: // will "fall through" to the next case... > case 2: { > do_something(); //will beexecuted if a==1 or >a==2 > break; > } >} > >// Sample 2 with (which is more readable in my opinion) >// but it's creating more or less the same code > > if (a==1 || a==2) { > do_something(); //will beexecuted if a==1 or a==2 > }; > >Best, Stephan From j_baraclough at zetnet.co.uk Fri Mar 9 11:51:57 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Fri Mar 9 12:00:13 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <45F19E0A.9090000@jpl.nasa.gov> References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> <45F19E0A.9090000@jpl.nasa.gov> Message-ID: Hi Bruce, I particularly like definition 4 there: 'To pray for deliverance from'. Maybe we can deprecate global warming, but that's another story. It's page 55 in my copy (K&R 1st Ed. c1978), but it also says on p56: "... Falling through from one case to another is not robust, being prone to disintegration when the program is modified." I've been there and done that. However I have also made use of the following construct: case 1: do_a_case1_only_action(); case 2: do_a_case1_and_2_action(); break; which is great when you write it, but a real pig when you come back to it some months later and think WTF is that all about. New versions of existing compilers must not break existing code by rejecting multiple case entries, however newer compilers (such as C#) are very specific about 'switch(){}'. Each 'case x:' must be single entry and must have a 'break;' and there must be a 'default:' with a 'break;' even if it's empty. To my mind, that's probably a good discipline to adopt. Even though it does lead to a certain amount of code bloat, it is totally portable. All the best for now, John At 17:48 09/03/2007, you wrote: >John Baraclough wrote: > >. >. >. >>You should be aware that multiple entry case statements are now >>deprecated (isn't that a wonderful word). They should not generate >>an error, but may well be non-portable. >. >. >. > http://dictionary.reference.com/browse/deprecate > >Why? The Bible (K&R 2nd Ed.) pg 58 states: > > "Each case is labeled by one or more integer-valued constants or > constant expressions. ..." > >If you change the rules now, you'll be breaking a lot of existing code. > >Bruce > > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070309/57895c2b/attachment.html From richard-lists at imagecraft.com Fri Mar 9 12:40:34 2007 From: richard-lists at imagecraft.com (Richard) Date: Fri Mar 9 12:48:36 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> Message-ID: <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> No it should not have any limit between cases. If it does, then it's a compiler bug and should be fixed. At 10:16 AM 3/9/2007, John Baraclough wrote: >The other reason for choosing the 'if(){} else if(){} else{}' construct >over 'switch(){}', is that there is a limited amount of code you can put >between 'case:' statements. Sometimes a 'switch(){}' will generate an 'Out >of range' (or something like that) error message, in which case an 'if()' >is the only solution. // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From jassenbaum at htp-tel.de Fri Mar 9 12:55:59 2007 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Fri Mar 9 13:02:39 2007 Subject: [Icc-avr] C question off topic References: <45F19E0A.9090000@jpl.nasa.gov> Message-ID: Ahm, I'd just say, that's, why I don't like cases in C so much :-) Johannes > Hi Bruce, > I particularly like definition 4 there: 'To pray for deliverance > from'. Maybe we can deprecate global warming, but that's another story. > It's page 55 in my copy (K&R 1st Ed. c1978), but it also says on p56: > "... Falling through from one case to another is not robust, being > prone to disintegration when the program is modified." > I've been there and done that. However I have also made use of the > following construct: > case 1: > do_a_case1_only_action(); > case 2: > do_a_case1_and_2_action(); > break; > which is great when you write it, but a real pig when you come back > to it some months later and think WTF is that all about. > New versions of existing compilers must not break existing code by > rejecting multiple case entries, however newer compilers (such as C#) > are very specific about 'switch(){}'. Each 'case x:' must be single > entry and must have a 'break;' and there must be a 'default:' with a > 'break;' even if it's empty. To my mind, that's probably a good > discipline to adopt. Even though it does lead to a certain amount of > code bloat, it is totally portable. > All the best for now, > John > At 17:48 09/03/2007, you wrote: >>John Baraclough wrote: >> >>. >>. >>. >>>You should be aware that multiple entry case statements are now >>>deprecated (isn't that a wonderful word). They should not generate >>>an error, but may well be non-portable. >>. >>. >>. >> http://dictionary.reference.com/browse/deprecate >> >>Why? The Bible (K&R 2nd Ed.) pg 58 states: >> >> "Each case is labeled by one or more integer-valued constants or >> constant expressions. ..." >> >>If you change the rules now, you'll be breaking a lot of existing code. >> >>Bruce >> >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr >> From j_baraclough at zetnet.co.uk Fri Mar 9 15:44:14 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Fri Mar 9 15:52:31 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> Message-ID: Hi Richard, I've never seen this in V7, but did have it occur on a few occasions with V6 (at least two years ago, possibly more). I overcame the problem then by moving in-line code into functions and reducing the span of the jump. I guess it has been fixed already. All the best for now, John At 20:40 09/03/2007, you wrote: >No it should not have any limit between cases. If it does, then it's >a compiler bug and should be fixed. > >At 10:16 AM 3/9/2007, John Baraclough wrote: >>The other reason for choosing the 'if(){} else if(){} else{}' >>construct over 'switch(){}', is that there is a limited amount of >>code you can put between 'case:' statements. Sometimes a >>'switch(){}' will generate an 'Out of range' (or something like >>that) error message, in which case an 'if()' is the only solution. > >// richard (This email is for mailing lists. To reach me directly, >please use richard at imagecraft.com) >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr > From richard-lists at imagecraft.com Fri Mar 9 16:00:32 2007 From: richard-lists at imagecraft.com (Richard) Date: Fri Mar 9 16:08:34 2007 Subject: [Icc-avr] C question off topic In-Reply-To: References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> Message-ID: <6.1.0.6.2.20070309160013.0a365408@192.168.100.42> I do recall fixing something similar.. At 03:44 PM 3/9/2007, you wrote: >Hi Richard, > >I've never seen this in V7, but did have it occur on a few occasions with >V6 (at least two years ago, possibly more). I overcame the problem then by >moving in-line code into functions and reducing the span of the jump. I >guess it has been fixed already. > >All the best for now, >John > // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From jwbacon at comcast.net Fri Mar 9 16:37:11 2007 From: jwbacon at comcast.net (Jim Bacon) Date: Fri Mar 9 16:45:50 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> Message-ID: <200703100045.l2A0jmSH078282@dragonsgate2.imagecraft.com> I'd really like to agree with that, Richard, but it seems to me that 'removing limits' like that could generate some "issues". We're not dealing with 32 bit flash space, nor are we looking at 'unlimited stack sizes' like we're used to on the PC. My preference would be to just declare a compiler limit publicly, and/or issue a caveat that this type of program structure can possibly be placed too near a 64K limit. At 01:40 PM 3/9/2007, you wrote: >No it should not have any limit between cases. If it does, then it's >a compiler bug and should be fixed. > >At 10:16 AM 3/9/2007, John Baraclough wrote: >>The other reason for choosing the 'if(){} else if(){} else{}' >>construct over 'switch(){}', is that there is a limited amount of >>code you can put between 'case:' statements. Sometimes a >>'switch(){}' will generate an 'Out of range' (or something like >>that) error message, in which case an 'if()' is the only solution. > >// richard (This email is for mailing lists. To reach me directly, >please use richard at imagecraft.com) >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr * Give me ambiguity or give me something else. * ***************************************************************** Jim Bacon jwbacon@comcast.net 303-666-9455 (H) http://adams22.homeip.net jbacon@boulder.mellesgriot.com (W) 720-494-4938 ext 329 (W) ... 720-494-9432 (FAX) From pladow at gmail.com Fri Mar 9 16:50:34 2007 From: pladow at gmail.com (Peter LaDow) Date: Fri Mar 9 16:58:47 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <200703100045.l2A0jmSH078282@dragonsgate2.imagecraft.com> References: <011a01c7623a$043c3bb0$b160ec82@Shagrat> <6.1.0.6.2.20070309123929.0a3300a0@192.168.100.42> <200703100045.l2A0jmSH078282@dragonsgate2.imagecraft.com> Message-ID: <9e264e780703091650x76ef27dfn79fcaf5754a06be6@mail.gmail.com> On 3/9/07, Jim Bacon wrote: > > I'd really like to agree with that, Richard, but it seems to me that > 'removing limits' like that could generate some "issues". > We're not dealing with 32 bit flash space, nor are we looking at > 'unlimited stack sizes' like we're used to on the PC. > My preference would be to just declare a compiler limit publicly, > and/or issue a caveat that this type of program structure can > possibly be placed too near a 64K limit. I think Richard is correct. Switch statements need not be implemented as relative branches. In fact, the GNU tools generate jump tables if the number of switch targets is large or the the size of each case statement is large. And if the jump table can hold any absolute target address, there is no limit to how large a case statement is (within the memory limits of course). And I suspect that is exactly how Richard does things if whatever heuristic he uses determines that a relative branch should not be used. -- -- "To love for the sake of being loved is human; to love for the sake of loving is Angelic." -- Alphonse de Lamartine -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070309/a6daf407/attachment.html From ivanv at realtimedesigns.com.au Fri Mar 9 19:10:51 2007 From: ivanv at realtimedesigns.com.au (Ivan Vernot) Date: Fri Mar 9 19:19:07 2007 Subject: [Icc-avr] switch/case (was C question off topic) Message-ID: <00c801c762c1$b615f150$4200a8c0@harry> Hello Richard, Speaking of the implementation of switch/case.. If I am not mistaken, ICCAVR V7 implements a switch/case block as a series of int (16bit) compares. It there any compelling reason why the 'smallest possible' type size is not used in the compare? This would not only increase speed but decrease code size as well? I find that most of my switch/case constructs use a byte sizes 'state variable' and would benefit a lot from this type of optimisation. Kind Regards Ivan Vernot On 10/03/2007 11:00:32 AM, Richard (richard-lists@imagecraft.com) wrote: > I do recall fixing something similar.. > > At 03:44 PM 3/9/2007, you wrote: > >Hi Richard, > > > >I've never seen this in V7, but did have it occur on a few occasions with > >V6 (at least two years ago, possibly more). I overcame the problem then > >by > >moving in-line code into functions and reducing the span of the jump. I > >guess it has been fixed already. > > > >All the best for now, > >John > > > > // richard (This email is for mailing lists. To reach me directly, please > use richard at imagecraft.com) > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr From j_baraclough at zetnet.co.uk Sat Mar 10 02:16:29 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Sat Mar 10 02:24:41 2007 Subject: [Icc-avr] switch/case (was C question off topic) In-Reply-To: <00c801c762c1$b615f150$4200a8c0@harry> References: <00c801c762c1$b615f150$4200a8c0@harry> Message-ID: Hi Ivan, This one has been around here for a long time. It's probably down to about #197 on Richard's 'To Do' list >:-}. Unfortunately the C specification calls for 'case x:' constant values to be of size 'int' and it would require an diversion from the spec to fix it. Something like: #pragma switch_size char #pragma switch_size int would be useful and save a lot of unnecessary compares with zero. It would definitely be an advantage for the devices with smaller Flash sizes. Maybe it could be an option in the code compression algorithm. All the best for now, John At 03:10 10/03/2007, you wrote: >Hello Richard, > >Speaking of the implementation of switch/case.. > >If I am not mistaken, ICCAVR V7 implements a switch/case block as a >series of int (16bit) compares. >It there any compelling reason why the 'smallest possible' type size >is not used in the compare? >This would not only increase speed but decrease code size as well? > >I find that most of my switch/case constructs use a byte sizes >'state variable' and would benefit a lot from this type of optimisation. > >Kind Regards >Ivan Vernot From richard-lists at imagecraft.com Sat Mar 10 02:46:20 2007 From: richard-lists at imagecraft.com (Richard) Date: Sat Mar 10 02:54:16 2007 Subject: [Icc-avr] switch/case (was C question off topic) In-Reply-To: References: <00c801c762c1$b615f150$4200a8c0@harry> Message-ID: <6.1.0.6.2.20070310024345.0b31ef08@192.168.100.42> No, not #197 :-) It's part of the 8 bit optimization coming real soon now (PRO only). I don't know if the first release will have the switch optimization in, but there should be some good performance improvements coming! At 02:16 AM 3/10/2007, John Baraclough wrote: >Hi Ivan, > >This one has been around here for a long time. It's probably down to about >#197 on Richard's 'To Do' list >:-}. Unfortunately the C specification >calls for 'case x:' constant values to be of size 'int' and it would >require an diversion from the spec to fix it. Something like: > >#pragma switch_size char >#pragma switch_size int > >would be useful and save a lot of unnecessary compares with zero. It would >definitely be an advantage for the devices with smaller Flash sizes. Maybe >it could be an option in the code compression algorithm. > >All the best for now, >John > > >At 03:10 10/03/2007, you wrote: >>Hello Richard, >> >>Speaking of the implementation of switch/case.. >> >>If I am not mistaken, ICCAVR V7 implements a switch/case block as a >>series of int (16bit) compares. >>It there any compelling reason why the 'smallest possible' type size is >>not used in the compare? >>This would not only increase speed but decrease code size as well? >> >>I find that most of my switch/case constructs use a byte sizes 'state >>variable' and would benefit a lot from this type of optimisation. >> >>Kind Regards >>Ivan Vernot > > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From schaefer at mabel.info Sat Mar 10 09:04:53 2007 From: schaefer at mabel.info (=?ISO-8859-1?Q?Thomas_Sch=E4fer?=) Date: Sat Mar 10 09:12:52 2007 Subject: SV: [Icc-avr] Problems w/ watchdog ATM2561 In-Reply-To: <23CAB4A1878E854994AB398BC4CF5B0E034F6B@SERVER.symetrics.local> References: <23CAB4A1878E854994AB398BC4CF5B0E034F6B@SERVER.symetrics.local> Message-ID: <45F2E535.4040004@mabel.info> Hi Svenn, That's it! Thanks a lot. regards, Thomas > Hi Thomas > > I had the same problem. > Found out, if I disable the watchdog before setting it up and enable it, then it worked fine... > > //Disable watchdog reset > WDR(); > MCUSR &= ~(1< WDTCSR = (1< WDTCSR = 0; //all zero, Turn off WDT > > Svenn :) > >> Hello, >> >> I'm struggling with the watchdog in a ATM2561. >> After setting up the entire system in Main(), I activate the watchdog with >> >> /// \brief enables the watchdog timer. >> /// \remarks Mode: System Reset >> /// \remarks Timeout: Twdt = 8s >> /// \warning After execution the WDR() macro has to be called repeatedly >> within Twdt >> void watchdog_enable(void) >> { >> CLI(); >> WDR(); >> WDTCSR |= (1<> WDTCSR = (1<> SEI(); >> } >> >> right before I enter the main loop. As long as I issue WDR's inside the >> main loop, everything works fine. Now I tried to test the watchdog >> functionality by commenting out the WDR macro, awaiting a system reset >> 8s after entering the main loop. But the system seems just to stop and >> remain in an undefined state. >> >> Any hints? >> >> regards, >> Thomas >> >> PS: I'm using V7.12 Professional. >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> >> > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr From richard at imagecraft.com Sat Mar 10 18:29:01 2007 From: richard at imagecraft.com (Richard) Date: Sat Mar 10 18:36:57 2007 Subject: [Icc-avr] 7.12A released Message-ID: <6.1.0.6.2.20070310182815.0b1ecba0@192.168.100.42> V7.12A - March 11th, 2007 IDE - The starting address for the 644P was incorrect (the only current "P" device with more interrupt vectors than the corresponding non-P devices. - For ISP with STK500, add a box for "No Erase." Use only if you pre-erase the chip. Linker - bootloader build for < 64K devices were broken WRT -e: switch added in 7.10B Library - added the missing cstrpbrk and the new cstrtok - the crt* startup files now always initialize RAMPZ to the appropriate value based on the project type. This is so that if you are building an application that is invoked by a bootloader, the startup file for the main app will initialize RAMPZ to zero, ensuring correct program behaviors. // richard On-line orders, support, and listservers available on web site. [ For technical support on ImageCraft products, please include all previous replies in your msgs. ] From t.jaspers at cpseurope.com Mon Mar 12 01:03:02 2007 From: t.jaspers at cpseurope.com (Jaspers, Ton) Date: Mon Mar 12 01:11:17 2007 Subject: [Icc-avr] C question off topic Message-ID: <7B0EB27CF1CC93439B5CFB7526E5D74C3BF5FE@mickey.PBNV.local> From: John Baraclough > I've been there and done that. However I have also made use of the following construct: > > case 1: > do_a_case1_only_action(); > > case 2: > do_a_case1_and_2_action(); > break; > > which is great when you write it, but a real pig when you come back to it some months later and think WTF is that all about. That is why I added to our in-house style guide that such cases have a madatory comment: case 1: do_a_case1_only_action(); /* Fall through is intentional */ case 2: do_a_case1_and_2_action(); break; I would be the first to admit that this is not a perfect solution, but it does help a little. Cheers, Ton Jaspers CPS Europe BV From sl at ecpower.dk Mon Mar 12 05:14:20 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 05:27:44 2007 Subject: [Icc-avr] SPI master and slave Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> Hi. In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). But do I run into problems during programming with the ISP? For example if I want to program the Slave and the master is talking on the SPI port, I probably run into trouble. Do I need resistors on the wires? How big? I would expect Atmel to have some application notes on this, but did not find any. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/4a4239f4/attachment.html From bobgardner at aol.com Mon Mar 12 05:32:13 2007 From: bobgardner at aol.com (bobgardner@aol.com) Date: Mon Mar 12 05:40:28 2007 Subject: [Icc-avr] SPI master and slave In-Reply-To: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> References: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> Message-ID: <8C932C1FAABC4B0-88C-961E@webmail-de08.sysops.aol.com> Programming pins on a 128 are rx0 and tx0 instead of mosi and miso, so maybe no prob? -----Original Message----- From: sl@ecpower.dk Sent: Mon, 12 Mar 2007 9:14 AM Subject: [Icc-avr] SPI master and slave Hi. In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). But do I run into problems during programming with the ISP? For example if I want to program the Slave and the master is talking on the SPI port, I probably run into trouble. Do I need resistors on the wires? How big? I would expect Atmel to have some application notes on this, but did not find any. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/eed22381/attachment.html From Thorsten.Geffers at ATSonline.de Mon Mar 12 05:45:59 2007 From: Thorsten.Geffers at ATSonline.de (Thorsten Geffers) Date: Mon Mar 12 05:54:15 2007 Subject: AW: [Icc-avr] SPI master and slave Message-ID: Hi Steven, maybe you should have a look at the Atmel application note AVR042: "AVR Hardware Design Considerations". There you find a part "Connecting ISP Lines". Maybe there you can find some useful information. Thorsten ________________________________ Von: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] Im Auftrag von Steven Lose Gesendet: Montag, 12. M?rz 2007 14:14 An: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribeto icc-announce if you are a member of this. Betreff: [Icc-avr] SPI master and slave Hi. In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). But do I run into problems during programming with the ISP? For example if I want to program the Slave and the master is talking on the SPI port, I probably run into trouble. Do I need resistors on the wires? How big? I would expect Atmel to have some application notes on this, but did not find any. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/a79b1ac3/attachment-0001.html From tim at sabretechnology.co.uk Mon Mar 12 06:11:48 2007 From: tim at sabretechnology.co.uk (Tim Mitchell) Date: Mon Mar 12 06:20:01 2007 Subject: [Icc-avr] SPI master and slave Message-ID: <04671BB8D269034BBC4BB6BA89486726061697@sserver.SabreTechnology.local> bobgardner@aol.com wrote: > > -----Original Message----- > From: sl@ecpower.dk > > Hi. > > In a new design, I want a Master (atmega 128) to talk to a Slave > (atmega8). > But do I run into problems during programming with the ISP? > For example if I want to program the Slave and the master is talking > on the SPI port, I probably run into trouble. > Do I need resistors on the wires? How big? > I would expect Atmel to have some application notes on this, but did > not find any. > > Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER > A/S Steven Lose Software Ingeni?r > Programming pins on a 128 are rx0 and tx0 instead of mosi and miso, > so maybe no prob? Would not help if programming the mega8 slave, the mega128 would be trying to drive the lines. When I had to do this, I tied the reset lines together on both chips, so any attempt to program one would hold them both in reset. -- Tim Mitchell tim@sabretechnology.co.uk http://www.sabretechnology.co.uk Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull HU6 7TQ Registered in England and Wales no.3131504 t:01482 801003 f:01482 801078 From sl at ecpower.dk Mon Mar 12 07:19:00 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 07:32:29 2007 Subject: SV: [Icc-avr] SPI master and slave Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4AA3@seattle.ecpower.dk> Hi. Thanks for the quick answers. Thorsten: I just read the note, looks god but does not say anything on size of the resistors, but did tell me that resistors is to be used on all 3 lines. I also thought on coupling the reset lines together, but as I understand it, the reset is only hold until programming mode is entered, so when reset is gone the one that is not in programming mode will boot and will make trouble on the lines, but maybe it's only a question on resistor size versus communication speed. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -----Oprindelig meddelelse----- Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af Tim Mitchell Sendt: 12. marts 2007 15:12 Til: Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this. Emne: RE: [Icc-avr] SPI master and slave bobgardner@aol.com wrote: > > -----Original Message----- > From: sl@ecpower.dk > > Hi. > > In a new design, I want a Master (atmega 128) to talk to a Slave > (atmega8). > But do I run into problems during programming with the ISP? > For example if I want to program the Slave and the master is talking > on the SPI port, I probably run into trouble. > Do I need resistors on the wires? How big? > I would expect Atmel to have some application notes on this, but did > not find any. > > Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER > A/S Steven Lose Software Ingeni?r > Programming pins on a 128 are rx0 and tx0 instead of mosi and miso, > so maybe no prob? Would not help if programming the mega8 slave, the mega128 would be trying to drive the lines. When I had to do this, I tied the reset lines together on both chips, so any attempt to program one would hold them both in reset. -- Tim Mitchell tim@sabretechnology.co.uk http://www.sabretechnology.co.uk Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull HU6 7TQ Registered in England and Wales no.3131504 t:01482 801003 f:01482 801078 _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From j_baraclough at zetnet.co.uk Mon Mar 12 07:42:30 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Mon Mar 12 07:50:43 2007 Subject: [Icc-avr] SPI master and slave In-Reply-To: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> References: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> Message-ID: Connect the ISP header pins for the slave directly to the mega8 MISO, MOSI & SCK and isolate these from the other processor with 1k resistors. You should do the same with the RXD0 pin on the mega128. TXD0 is OK without a resistor and SCK will be isolated by the resistor that goes to the mega8 pins. A picture is worth 1k words so view this in a fixed pitch font such as Courier. ISP ISP ___ | | | | | | RXD0 -|___|-------)-)-+ | | | | | | | | TXD0 -------------)-+ | | | | | | | | ___ | | | MOSI -------------)------|___|--)-o-)---- MISO | | | | ___ | | M128 MISO -------------)------|___|--)---o---- MOSI M8 | | | ___ | SCK -------------o------|___|--o-------- SCK (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) All the best for now, John At 13:14 12/03/2007, you wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C764A8.57BB54C1" > >Hi. > >In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). >But do I run into problems during programming with the ISP? >For example if I want to program the Slave and >the master is talking on the SPI port, I probably run into trouble. >Do I need resistors on the wires? How big? >I would expect Atmel to have some application >notes on this, but did not find any. > > >Med venlig hilsen / Best regards / mit freundlichen Gr??en > >EC POWER A/S > >Steven Lose > >Software Ingeni?r > >Tlf.: +45 87434100 > >Direkte tlf. +45 58286608 > >Email: sl@ecpower.dk > >www.ecpower.dk > >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/99289d3f/attachment.html From sl at ecpower.dk Mon Mar 12 08:06:12 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 08:23:20 2007 Subject: SV: [Icc-avr] SPI master and slave Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4AAB@seattle.ecpower.dk> Thanks John. What is the reason for RXD0 resistor? Haven't heard about this one before. How did you end up with the 1K value? Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk ________________________________ Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af John Baraclough Sendt: 12. marts 2007 16:42 Til: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Emne: Re: [Icc-avr] SPI master and slave Connect the ISP header pins for the slave directly to the mega8 MISO, MOSI & SCK and isolate these from the other processor with 1k resistors. You should do the same with the RXD0 pin on the mega128. TXD0 is OK without a resistor and SCK will be isolated by the resistor that goes to the mega8 pins. A picture is worth 1k words so view this in a fixed pitch font such as Courier. ISP ISP ___ | | | | | | RXD0 -|___|-------)-)-+ | | | | | | | | TXD0 -------------)-+ | | | | | | | | ___ | | | MOSI -------------)------|___|--)-o-)---- MISO | | | | ___ | | M128 MISO -------------)------|___|--)---o---- MOSI M8 | | | ___ | SCK -------------o------|___|--o-------- SCK (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) All the best for now, John At 13:14 12/03/2007, you wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C764A8.57BB54C1" Hi. In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). But do I run into problems during programming with the ISP? For example if I want to program the Slave and the master is talking on the SPI port, I probably run into trouble. Do I need resistors on the wires? How big? I would expect Atmel to have some application notes on this, but did not find any. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/9112054f/attachment-0001.html From j_baraclough at zetnet.co.uk Mon Mar 12 08:32:21 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Mon Mar 12 08:40:32 2007 Subject: [Icc-avr] SPI master and slave In-Reply-To: References: <072D96786BFC014AAEBA9EB07A8070EA1A4A7A@seattle.ecpower.dk> Message-ID: Correction to diagram below. I put the RXD0 resistor in the wrong place. All resistors are 1k. John >A picture is worth 1k words so view this in a >fixed pitch font such as Courier. > > ISP RS232 ISP > > | | | ___ | | | | > RXD0 ---------)-)-+---|___|-+ | | | > | | | | | > TXD0 ---------)-+ | | | > | | | | > | ___ | | | > MOSI ---------)--------|___|-------)-o-)---- MISO > | | | > | ___ | | > M128 MISO ---------)--------|___|-------)---o---- MOSI M8 > | | > | ___ | > SCK ----------o--------|___|-------o-------- SCK > > >(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) > > >All the best for now, >John > > >At 13:14 12/03/2007, you wrote: >>Content-class: urn:content-classes:message >>Content-Type: multipart/alternative; >> boundary="----_=_NextPart_001_01C764A8.57BB54C1" >> >>Hi. >> >>In a new design, I want a Master (atmega 128) to talk to a Slave (atmega8). >>But do I run into problems during programming with the ISP? >>For example if I want to program the Slave and >>the master is talking on the SPI port, I probably run into trouble. >>Do I need resistors on the wires? How big? >>I would expect Atmel to have some application >>notes on this, but did not find any. >> >> >>Med venlig hilsen / Best regards / mit freundlichen Gr??en >> >>EC POWER A/S >> >>Steven Lose >> >>Software Ingeni?r >> >>Tlf.: +45 87434100 >> >>Direkte tlf. +45 58286608 >> >>Email: sl@ecpower.dk >> >>www.ecpower.dk >> >>_______________________________________________ >>Icc-avr mailing list >>Icc-avr@imagecraft.com >>http://dragonsgate.net/mailman/listinfo/icc-avr >_______________________________________________ >Icc-avr mailing list >Icc-avr@imagecraft.com >http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/bafd5995/attachment.html From j_baraclough at zetnet.co.uk Mon Mar 12 08:57:03 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Mon Mar 12 09:05:14 2007 Subject: SV: [Icc-avr] SPI master and slave In-Reply-To: <072D96786BFC014AAEBA9EB07A8070EA1A4AAB@seattle.ecpower.dk> References: <072D96786BFC014AAEBA9EB07A8070EA1A4AAB@seattle.ecpower.dk> Message-ID: Hi Steven, Our posts have crossed so there's a later one with a corrected diagram. The resistor on RXD0 ensures that no signal on the RS232 receiver will interfere with the ISP when it is operating. The value is sufficient to ensure isolation but not large enough to interfere with normal operation when the ISP isn't active. It's a simple trick that I picked up from one of the very early Atmel data sheets. They don't put that particular diagram in the data sheets any more. There's a similar trick to be aware of when using SPI memory on AVR's that use the SPI signals for programming. The SPI memory MISO signal can become active when the chip select is floating during programming and it can cause a programming failure. It needs either a 10k pull-up on the #CS line or a 1k isolating resistor in the MISO line between the memory chip and the processor. Again the ISP must be connected directly to the processor pins. All the best for now, John At 16:06 12/03/2007, you wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C764C0.DFF02675" > >Thanks John. > >What is the reason for RXD0 resistor? Haven?t heard about this one before. >How did you end up with the 1K value? > > >Med venlig hilsen / Best regards / mit freundlichen Gr??en > >EC POWER A/S > >Steven Lose > >Software Ingeni?r > >Tlf.: +45 87434100 > >Direkte tlf. +45 58286608 > >Email: sl@ecpower.dk > >www.ecpower.dk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/46c0bc83/attachment.html From sl at ecpower.dk Mon Mar 12 10:55:42 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 11:09:26 2007 Subject: SV: SV: [Icc-avr] SPI master and slave Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4AAD@seattle.ecpower.dk> Thanks a lot. I guess this diagram also solves the ISP upgrade failure problem, when AVR STUDIO says that ISP need upgrade, - tries and fails on verify. Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk ________________________________ Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af John Baraclough Sendt: 12. marts 2007 17:57 Til: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Emne: Re: SV: [Icc-avr] SPI master and slave Hi Steven, Our posts have crossed so there's a later one with a corrected diagram. The resistor on RXD0 ensures that no signal on the RS232 receiver will interfere with the ISP when it is operating. The value is sufficient to ensure isolation but not large enough to interfere with normal operation when the ISP isn't active. It's a simple trick that I picked up from one of the very early Atmel data sheets. They don't put that particular diagram in the data sheets any more. There's a similar trick to be aware of when using SPI memory on AVR's that use the SPI signals for programming. The SPI memory MISO signal can become active when the chip select is floating during programming and it can cause a programming failure. It needs either a 10k pull-up on the #CS line or a 1k isolating resistor in the MISO line between the memory chip and the processor. Again the ISP must be connected directly to the processor pins. All the best for now, John At 16:06 12/03/2007, you wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C764C0.DFF02675" Thanks John. What is the reason for RXD0 resistor? Haven't heard about this one before. How did you end up with the 1K value? Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/de9ae5a9/attachment.html From albert.vanveen at pertronic.co.nz Mon Mar 12 11:31:38 2007 From: albert.vanveen at pertronic.co.nz (Albert van Veen) Date: Mon Mar 12 11:39:58 2007 Subject: [Icc-avr] C question off topic In-Reply-To: <7B0EB27CF1CC93439B5CFB7526E5D74C3BF5FE@mickey.PBNV.local> Message-ID: You can make this intention more obvious (what I would do) by writing it like this: case 1: case 2: if (case 1) do_a_case1_only_action(); do_a_case1_and_2_action(); break; Would give hardly (if any) more code. Albert. -----Original Message----- From: Jaspers, Ton [mailto:t.jaspers@cpseurope.com] Sent: Monday, 12 March 2007 10:03 p.m. To: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Subject: RE: [Icc-avr] C question off topic From: John Baraclough > I've been there and done that. However I have also made use of the following construct: > > case 1: > do_a_case1_only_action(); > > case 2: > do_a_case1_and_2_action(); > break; > > which is great when you write it, but a real pig when you come back to it some months later and think WTF is that all about. That is why I added to our in-house style guide that such cases have a madatory comment: case 1: do_a_case1_only_action(); /* Fall through is intentional */ case 2: do_a_case1_and_2_action(); break; I would be the first to admit that this is not a perfect solution, but it does help a little. Cheers, Ton Jaspers CPS Europe BV _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From j_baraclough at zetnet.co.uk Mon Mar 12 11:46:43 2007 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Mon Mar 12 11:54:55 2007 Subject: SV: SV: [Icc-avr] SPI master and slave In-Reply-To: <072D96786BFC014AAEBA9EB07A8070EA1A4AAD@seattle.ecpower.dk> References: <072D96786BFC014AAEBA9EB07A8070EA1A4AAD@seattle.ecpower.dk> Message-ID: Hi Steven, I'm not sure about that. Atmel recommends that the signal pins are all unconnected for upgrading. I have a 10-pin ISP connector with only +5V and GND connected, that works for ISP upgrading every time. Incidentally I recently upgraded Studio from 4.11 to 4.12 SP4 and when I tried the ISP it told me I needed to upgrade from version 2.01 to version 2.00!!! That tells me there was something wrong with version 2.01, but AFAIK nothing has been said. All the best for now, John At 18:55 12/03/2007, you wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C764D8.106A897F" > >Thanks a lot. > >I guess this diagram also solves the ISP upgrade >failure problem, when AVR STUDIO says that ISP >need upgrade, - tries and fails on verify. > > >Med venlig hilsen / Best regards / mit freundlichen Gr??en > >EC POWER A/S > >Steven Lose > >Software Ingeni?r > >Tlf.: +45 87434100 > >Direkte tlf. +45 58286608 > >Email: sl@ecpower.dk > >www.ecpower.dk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070312/3e14faec/attachment.html From robertrade at yahoo.com Mon Mar 12 14:44:11 2007 From: robertrade at yahoo.com (Robert Rademacher) Date: Mon Mar 12 14:52:19 2007 Subject: [Icc-avr] Re: Icc-avr Digest, Vol 32, Issue 12 In-Reply-To: <200703121645.l2CGj1Ve017404@dragonsgate2.imagecraft.com> Message-ID: <444700.87448.qm@web60411.mail.yahoo.com> Hi, Have you ever considered using I2C/TWI bus for Mega128master-Mega8slave connection, if 400kb speed is sufficient for you? I used it on my systems, which works very nicely. Robert =========================== Connect the ISP header pins for the slave directly to the mega8 MISO, MOSI & SCK and isolate these from the other processor with 1k resistors. You should do the same with the RXD0 pin on the mega128. TXD0 is OK without a resistor and SCK will be isolated by the resistor that goes to the mega8 pins. A picture is worth 1k words so view this in a fixed pitch font such as Courier. ISP ISP ___ | | | | | | RXD0 -|___|-------)-)-+ | | | | | | | | TXD0 -------------)-+ | | | | | | | | ___ | | | MOSI -------------)------|___|--)-o-)---- MISO | | | | ___ | | M128 MISO -------------)------|___|--)---o---- MOSI M8 | | | ___ | SCK -------------o------|___|--o-------- SCK (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) All the best for now, John ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From sl at ecpower.dk Mon Mar 12 15:08:27 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 15:21:54 2007 Subject: SV: [Icc-avr] Re: Icc-avr Digest, Vol 32, Issue 12 Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4AAF@seattle.ecpower.dk> Hi Robert. Would be a good solution to, but in this case I already have these pins in use with other SPI devices and I'm out of pins. Thanks Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk -----Oprindelig meddelelse----- Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af Robert Rademacher Sendt: 12. marts 2007 23:44 Til: icc-avr@imagecraft.com Emne: [Icc-avr] Re: Icc-avr Digest, Vol 32, Issue 12 Hi, Have you ever considered using I2C/TWI bus for Mega128master-Mega8slave connection, if 400kb speed is sufficient for you? I used it on my systems, which works very nicely. Robert =========================== Connect the ISP header pins for the slave directly to the mega8 MISO, MOSI & SCK and isolate these from the other processor with 1k resistors. You should do the same with the RXD0 pin on the mega128. TXD0 is OK without a resistor and SCK will be isolated by the resistor that goes to the mega8 pins. A picture is worth 1k words so view this in a fixed pitch font such as Courier. ISP ISP ___ | | | | | | RXD0 -|___|-------)-)-+ | | | | | | | | TXD0 -------------)-+ | | | | | | | | ___ | | | MOSI -------------)------|___|--)-o-)---- MISO | | | | ___ | | M128 MISO -------------)------|___|--)---o---- MOSI M8 | | | ___ | SCK -------------o------|___|--o-------- SCK (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) All the best for now, John ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From sl at ecpower.dk Mon Mar 12 15:10:17 2007 From: sl at ecpower.dk (Steven Lose) Date: Mon Mar 12 15:23:44 2007 Subject: SV: SV: SV: [Icc-avr] SPI master and slave Message-ID: <072D96786BFC014AAEBA9EB07A8070EA1A4AB0@seattle.ecpower.dk> Hi John. Tried that to, from 2.07 to 2.xx something and it said downgrade, weird! Med venlig hilsen / Best regards / mit freundlichen Gr??en EC POWER A/S Steven Lose Software Ingeni?r Tlf.: +45 87434100 Direkte tlf. +45 58286608 Email: sl@ecpower.dk www.ecpower.dk ________________________________ Fra: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] P? vegne af John Baraclough Sendt: 12. marts 2007 20:47 Til: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Emne: Re: SV: SV: [Icc-avr] SPI master and slave Hi Steven, I'm not sure about that. Atmel recommends that the signal pins are all unconnected for upgrading. I have a 10-pin ISP connector with only +5V and GND connected, that works for ISP upgrading every time. Incidentally I recently upgraded Studio from 4.11 to 4.12 SP4 and when I tried the ISP it told me I needed to upgrade from version 2.01 to version 2.00!!! That tells me there was something wrong with version 2.01, but AFAIK nothing has been said. All the best for now, John At 18:55 12/03/2007, you wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C764D8.106A897F" Thanks a lot. I guess this diagram also solves the ISP upgrade failure problem, when AVR STUDIO says that ISP need upgrade, -