Ok, that was what you have found. :) best wishes, On Sun, Aug 7, 2022 at 9:26 AM Rob CJ <rob...@hotmail.com> wrote:
> Hi Vasile, > > The program that did not work at 4 MHz had no interrupts or other things > running so the limitation was really the fact that the microcontroller was > running at 4 MHz. > > As far as I know this would be the only library that needs a warning not > to be used at 4 MHz 🙂. > > Kind regards, > > Rob > > ------------------------------ > *Van:* jallib@googlegroups.com <jallib@googlegroups.com> namens vsurducan > <vsurdu...@gmail.com> > *Verzonden:* zondag 7 augustus 2022 06:14 > *Aan:* jallib@googlegroups.com <jallib@googlegroups.com> > *Onderwerp:* Re: [jallib] DS18B20 was IF/END IF usage limit?? > > Hi Rob, > When using DS18B20 with an interrupted USB serial driver you also have to > turn off the USB interrupts during communication with the sensor. This is > mandatory if you have for example 8 sensors which are repeatedly sampled > and readed. > You know well that you can not turn off GIE because the USB communication > will then be lost. :) > > BTW, I have an automation for two solar water heaters that I made 10 or 12 > years ago which use DS18B20 and an 8MHz PIC16F886. Display is on > multiplexed 8 digit. I needed a long time solving an issue with the code > length, one extra instruction in the source and the stuff was inoperable, > no matter which was that instruction. :) The extra time of the loop ( one > more instruction) was killing the communication with the sensor. > > Perhaps multiple warnings would be necessary :) :P > > > On Sat, Aug 6, 2022 at 9:02 PM Rob CJ <rob...@hotmail.com> wrote: > > Hi Filip, > > Are you saying that the code is executing slow? > > If you can share your program or at least the part that is problematic (so > it can be reproduced) that could help. > > BTW (for Vasile 🙂). I recently worked on a problem of Hans using the > DS18B20. It did work on one PIC but not on a smaller one. Finally the root > cause was the PIC running at 4 MHz which was too slow to create the correct > one-wire timing for the DS18B20. Switching to 8 MHz solved the problem. > This was the first time that I encountered that a library did not work > because of a clock speed begin to low. Maybe we should add a warning to > that library. > > Kind regards, > > Rob > > ------------------------------ > *Van:* jallib@googlegroups.com <jallib@googlegroups.com> namens flyway38 < > fsfon...@gmail.com> > *Verzonden:* zaterdag 6 augustus 2022 18:39 > *Aan:* jallib <jallib@googlegroups.com> > *Onderwerp:* Re: [jallib] IF/END IF usage limit?? > > Hi Vasile, > > Thank you for the quick reply. > Is have that feeling about something not right at some point of the code. > In fact tried to exchange some "if/end if" for "case of" but no luck. > Problem persists, but it seems only related to "if/end if" usage.. > > My code reads the ADC (PIC18F2550), for 100 times in a "for/end loop". > Then find the median of values read and send that median value to RS232. > Also has a button to do some extra actions. > All this code worked great even in a smaller PIC (16F18313). > > Now have changed PIC for the 18F2550 and wanted to add some extra code to > manage PWM and ADC reading times to find the median value. > Also added an oled display to show locally that value and the PWM/ ADC nr. > of readings parameters. That's when this issue raised up. > Simptoms are the code running sluggish, not hangging... > Any ideas? > Thank you very much. > > Cheers, > Filipe Santos > > > On Saturday, August 6, 2022 at 5:13:36 PM UTC+1 vasile wrote: > > This issue appears usually when you do not manage in a correct way the > timing required by a specific hardware and the costs of your code length is > higher than required for the device to run properly. Common workaround is > to use interrupts or other sequential techniques. > > Example: DS18B20 is a temperature sensor which requires 750ms or so for a > 12bit conversion. If you have complex software involving USB interrupts, > real time clock generation, 7segment LED multiplexed display, etc , and > those are not shared correctly with your resources ( aka you try everything > to be solved in pure software) at one moment your code will freeze at a > specific code length. Removing some lines, no matter that are if/end if or > something else will apparently make your code functional, but the issue is > not where you suppose it is... > > Instead of if/end if you may use "case of". However it will not do > something special or different compared with if/end if, except a more > understandable structure for your source. > best wishes, > > > On Sat, Aug 6, 2022 at 7:00 PM flyway38 <fsfo...@gmail.com> wrote: > > Hi all, > > Is there any limit in using IF/ END IF conditions? > My code was running good untill added one more IF/END IF. > At first didn't realize about a limit in using these conditions code, but > then figured out that any other IF/END IF removal would let my code run ok > again... > Does anyone knows anything about this issue? > Thank you very much. > > Cheers, > Filipe Santos. > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jallib+un...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/3f8189dd-fd0a-4df9-8948-518503485e61n%40googlegroups.com > <https://groups.google.com/d/msgid/jallib/3f8189dd-fd0a-4df9-8948-518503485e61n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jallib+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/d77c7605-af0d-43ff-b2fb-4fe3a987e507n%40googlegroups.com > <https://groups.google.com/d/msgid/jallib/d77c7605-af0d-43ff-b2fb-4fe3a987e507n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jallib+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/GVXP195MB1637E3239BEDEC270DDF22E7E6619%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM > <https://groups.google.com/d/msgid/jallib/GVXP195MB1637E3239BEDEC270DDF22E7E6619%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jallib+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsAGVNa7oODgMNhMRNMHDsf3xT9zoPVMP1Y9gPS09JWXQ%40mail.gmail.com > <https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsAGVNa7oODgMNhMRNMHDsf3xT9zoPVMP1Y9gPS09JWXQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jallib+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/GVXP195MB1637B71DCF03CBDFA6D1F8CBE6609%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM > <https://groups.google.com/d/msgid/jallib/GVXP195MB1637B71DCF03CBDFA6D1F8CBE6609%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to jallib+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CAM%2Bj4quJYsxHDUaMjBp-%2BKrD9tzjoNVfHU1MK3UO5KrTg4k9Fg%40mail.gmail.com.