Hi Rob,
> > > This brings me to an issue where I'd like to know you opinion about: > > what do you think of 'defaults' and standard configurations like > > configure_clock(20_000,false) -- false: not internal clock > > My credo: Never trust defaults (may change with a new release), always > specify a value. This is equivalent of not having defaults at all. > When a required parameter is not specified the library should give a > proper error message (you cannot always rely on the compiler to give an > adequate message in such a case). This is not about defaults here, this is about providing an easier way to configure clock speed. For instance, every time I start a jal file from scratch, using 8MHz internal clock, I always have to find what is the register name: INTIO_NOOSCCCKOUT ? ... I also played with 18F4550 and PLL: with a 20MHz Xtal, you can make your PIC running @48MHz. Gosh!... To have this, incantation is hard: pragma target clock 48_000_000 pragma target PLLDIV DIVIDE_BY_5__20MHZ_INPUT_ pragma target CPUDIV _OSC1_OSC2_SRC___1__96MHZ_PLL_SRC___2_ pragma target USBPLL CLOCK_SRC_FROM_96MHZ_PLL_2 pragma target OSC HS_PLL Can't we make it easier ? If some case, you'll have to do this potion yourself, but most of the time, you just want a "classical" speed: 20, 16, 10, 8, 4, 2, 1MHz, then all those 31KHz, etc... either internal or external. So... My idea was to provide a configure_clock() procedure. It would looks like: procedure configure_clock(word in speed, bit in internal) is -- blabla about "if internal...", if speed == 20_000_000" etc... end procedure Then, you program would look like: include 16f88 -- maybe include a lib where configure_clock is, or make it included in devide files, I don't know configure_clock(8_000_000,true) OK, now I have my PIC configured to run @8Mhz, using internal oscillator. Careful/Note/NB: this is *nothing* about EZ mode, defaults or something like that. That said, we may have a problem with PLL: how to tell the procedure that I have a 20MHz Xtal, but 48MHz should be the configured speed with "pragma target clock 48_000_000 ? Maybe the procedure should two parameters: the speed you want your PIC to run at, the speed you have with your Xtal. configure_clock(20_000_000, 20_000_000) -- 20MHz Xtal configure_clock(8_000_000,0) -- no Xtal speed ? Means internal osc ! configure_clock(48_000_000,20_000_000) -- Mmmh... looks like we have to do some PLL incantation... What's your opinion ? Seb -- Sébastien Lelong http://www.sirloon.net http://sirbot.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
