Indeed, an improvement. For an improved version of the program, using adc, serial lib and non- blocking delays, I had to tweak the library of Joep to "cut" the slots and make it for one delay at a time, to squeeze it enough to fit That was with the old version of compiler and libs..
I guess now it will not fit but now I have a little more experience so I can deal with the problem. Also, a bigger microcontroller can be used, as 12F683. But it was nice to do a little more with 12F675 than what it was done in Basic with a PICAXE08M/12F683. Vasi Sebastien Lelong wrote: > Hi, > > Using latest SVN, old version gives (don't forget google groups handles > attachments...): > > jal 2.4o (compiled Nov 28 2010) > generating p-code > 1630 tokens, 90953 chars; 2430 lines; 7 files > generating PIC code pass 1 > generating PIC code pass 2 > writing result > /opt/local/perso/jallib/include/peripheral/adc/adc_hardware.jal:58: warning: > "adc_hardware is being deprecated, you should consider using new adc.jal > library" > Code area: 489 of 1024 used (words) > Data area: 44 of 62 used > Software stack available: 18 bytes > Hardware stack depth 4 of 8 > 0 errors, 1 warnings > > > > New version gives: > > jal 2.4o (compiled Nov 28 2010) > generating p-code > 1636 tokens, 220388 chars; 5925 lines; 9 files > generating PIC code pass 1 > generating PIC code pass 2 > writing result > Code area: 559 of 1024 used (words) > Data area: 45 of 62 used > Software stack available: 17 bytes > Hardware stack depth 4 of 8 > 0 errors, 0 warnings > > > > Not the same figures even if, yes, it's bigger. > > > Cheers, > Seb > > > > > 2011/1/5 funlw65(Vasi) <[email protected]> > > > And this is the new one, migrated to the new adc lib: > > > > -- JAL 2.4i - Windctrl.jal > > -- purpose : Windmill controller with 12F675 > > -- author : Vasile Guta Ciucur > > -- date : 03-MAY-2009 > > -- used: Jallib package 0.2.0 (http://code.google.com/p/jallib/) > > > > include 12f675 > > -- set fuses > > pragma target clock 4_000_000 > > pragma target OSC INTOSC_NOCLKOUT > > pragma target WDT DISABLED > > pragma target PWRTE DISABLED > > pragma target MCLR INTERNAL > > pragma target CPD DISABLED > > pragma target CP DISABLED > > pragma target BROWNOUT DISABLED > > --pragma target BG HIGHEST_BANDGAP_VOLTAGE > > > > -- variable declarations > > var word Volt > > > > -- Configure ADC > > -- We won't use any external VRef, so measures are done > > -- according to PIC powering voltage > > const byte ADC_NVREF = 0 > > -- The maximum resistance while measuring ADC is... (unit: ohms) > > -- Being accurate helps speeding up ADC acquisition > > const word ADC_RSOURCE = 2_000 > > -- In this example, we'll perform high resolution ADC: results are > > -- coded on 16bits > > const bit ADC_HIGH_RESOLUTION = true > > > > include adc > > > > -- define transmission settings > > const Serial_SW_Baudrate = 4800 > > const Serial_SW_invert = false > > > > -- define the software transmit pin > > var volatile bit Serial_SW_tx_pin is GPIO_GP0 > > > > -- use following line to deactivate rx if you don't need it > > var volatile bit Serial_SW_rx_pin > > > > include Serial_Software > > include format > > > > -- registers_setup (INIT routine in assembler) > > assembler > > -- ======================== > > bsf _status, _rp0 -- bank 1 > > -- ======================== > > call 0x3ff -- get the factory calibrated OSC value > > movwf osccal -- for accurate timing > > -- ------------- start ------------------- > > -- gp0, gp1, gp2 as output > > -- gp3, gp4 and gp5 as input > > movlw 0b_0011_1000 > > movwf trisio > > -- ------------- end --------------------- > > clrf wpu -- wpu = 0 > > -- -------===-- start --------- > > -- an0(gp0), an1(gp1) and an2(gp2) set as digital > > -- an3(gp4) as analog > > movlw 0b_0011_1000 > > movwf ansel > > -- ------------ end ----------- > > -- ======================== > > bcf _status, _rp0 -- bank 0 > > -- ======================== > > clrf gpio -- init gpio > > -- -------===-- start --------- > > movlw 0b_0000_0111 -- 7 decimal, > > movwf cmcon -- that mean comparator off > > -- ------------ end ----------- > > -- we don't set adcon0 register because is > > -- set by adc_read() routine > > end assembler > > -- end registers_setup > > > > -- Initialize ADC > > adc_init() > > set_analog_pin(3) > > > > -- start initializations if functions are used > > Serial_SW_init > > > > forever loop > > -- read data > > Volt = adc_read(3) -- (GP4) > > -- see if charging/diverting is needed > > if Volt > 571 then -- 14.3V > > GPIO_GP1 = 0 > > end if > > if Volt < 558 then -- 13V > > GPIO_GP1 = 1 > > end if > > if Volt > 557 then -- 13V > > GPIO_GP2 = 0 > > end if > > if Volt < 545 then -- ~11V > > GPIO_GP2 = 1 > > end if > > -- sending to PC the digital value of battery voltage measurement > > -- for calibration purposes > > format_word_dec(serial_sw_data, Volt, 4, 0) > > -- carriage return and line feed > > serial_sw_write(13) > > serial_sw_write(10) > > -- > > end loop > > > > > > > > and the result is: > > > > jal 2.4n (compiled Jun 2 2010) > > 0 errors, 0 warnings > > Code area: 720 of 1024 used (words) > > Data area: 45 of 62 used > > Software stack available: 17 bytes > > Hardware stack depth 4 of 8 > > > > > > On Jan 5, 2:34 pm, Sebastien Lelong <[email protected]> > > wrote: > > > Hi Vasi, > > > > > > Instead of providing links to images, please provide source code and > > > compiler output in text format for both on your examples. > > > > > > TIA > > > Cheers, > > > Seb > > > > > > 2011/1/5 funlw65(Vasi) <[email protected]> > > > > > > > Hi guys, > > > > > > > I tried to recompile the application from here > > > > > > >https://sites.google.com/site/funlw65/electronics/windmill-controller. > > .. > > > > and, because compiler reported the use of a deprecated library (the > > > > old adc lib), I changed it to use the new one. The code resulted is > > > > huge. See the two images for comparison. > > > > > > > - the old one: > > > > > > >http://lh6.ggpht.com/_Z3E9awpWQh4/TSRZmpSPTjI/AAAAAAAAJU0/kVp3lxYU0uc. > > .. > > > > > > > - the new one: > > > > > > >http://lh6.ggpht.com/_Z3E9awpWQh4/TSRZm64SfZI/AAAAAAAAJU4/KOgxErr9UX0. > > .. > > > > > > > Fortunately, the old lib is still here (and maybe, the Bert's > > > > package). > > > > > > > Vasi > > > > > > > -- > > > > 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]<jallib%[email protected]> > > <jallib%[email protected]<jallib%[email protected]> > > > > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/jallib?hl=en. > > > > -- > > 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]<jallib%[email protected]> > > . > > For more options, visit this group at > > http://groups.google.com/group/jallib?hl=en. > > > > > > > -- > 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.
