I compiled/loaded this code and my 12f629 is working nice (using libs
from svn and pickit 2 with low pin count demo board):

include 12f629                    -- target PICmicro
--
-- This program uses the internal oscillator at 4MHz
pragma target clock 4_000_000     -- oscillator frequency
-- configuration memory settings (fuses)
pragma target OSC  INTOSC_NOCLKOUT -- internal oscillator
pragma target WDT  disabled        -- no watchdog
pragma target MCLR external        -- reset externally
--

assembler
  -- ========================
  bsf _status, _rp0 -- bank 1
  -- ========================
  call  0x3ff   -- get the factory calibrated OSC value
  movwf osccal  -- for accurate timing
  -- ------------- start -------------------
  -- ========================
  bcf _status, _rp0 -- bank 0
  -- ========================
end assembler


enable_digital_io()                -- disable analog I/O (if any)
--
-- You may want to change the selected pin:
alias   led      is pin_A0
pin_A0_direction =  output
--
forever loop
   led = on
   _usec_delay(250000)
   led = off
   _usec_delay(250000)
end loop

Vasi

On Nov 11, 9:58 pm, Rob Hamerling <[email protected]> wrote:
> funlw65 wrote:
> > Hmm, guys you forgot about this:
>
> > assembler
> >   -- ========================
> >   bsf _status, _rp0 -- bank 1
> >   -- ========================
> >   call  0x3ff   -- get the factory calibrated OSC value
> >   movwf osccal  -- for accurate timing
> >   -- ==================
> >   bcf _status, _rp0 -- bank 0
> >   -- ==================
> > end assembler
>
> You are right that OSCCAL should be loaded with the calibrated value in
> that high-memory location. And not only for the 2 PICs you mention, but
> also for a number of others. I have a note in my todo list: 10Fs,
> 12F508,509,510,519,629,675 and 16F505,506,630,676, maybe more.
>
> I think a simple 'asm movwf OSCCAL' as very first instruction will be
> enough, because with a reset the program counter is set to the last
> memory location (e.g. DS41239D 4.7.1 and 9.2.2).
>
> Changing OSCCAL is fine tuning, omitting OSC calibration will not be the
> cause that a led doesn't blink at all, only the blink frequency may be a
> bit different.
>
> When an accurate frequency is a required an external oscillator is the
> way to go.
>
> We have discussed the OSCCAL issue in the begin-period of the Jallib
> group and decided then to spend out time on more urgent things.
>
> > Should be included in device file for 12F629 and 12F675.
>
> And in some others, if in the device files at all. It requires
> co-operation with the compiler, because the compiler decides where code
> is store in memory. Maybe it should be a pragma.
>
> > Also, you
> > must pay attention at burning time, to not override that location of
> > flash memory....
>
> True, use a proper programmer!
>
> Regards, Rob.
>
> --
> Rob Hamerling, Vianen, NL (http://www.robh.nl/)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to