Solved in a weird mode. The following code is sending OSC/4 on clkout pin
if A4 is ON inside a loop.
Without a loop, A4 is permanently low.

include 12f1572                     -- target PICmicro
--
;pragma target clock    32_000_000       -- oscillator frequency
pragma target clock    8_000_000       -- oscillator frequency
--
pragma target OSC      INTOSC_NOCLKOUT           -- internal oscillator
pragma target PLLEN    DISABLED                  -- PLL off
pragma target CLKOUTEN ENABLED                  -- clock output enabled
pragma target WDT      DISABLED                  -- watchdog
pragma target BROWNOUT DISABLED                  -- no brownout reset
pragma target LVP      ENABLED                   -- low voltage programming
pragma target MCLR     EXTERNAL                  -- external reset
--

OSCCON_SCS = 0                      -- select primary oscillator
OSCCON_IRCF = 0b1110                -- 8 MHz
;OSCCON_SPLLEN = ENABLED               -- software PLL on   8x4=32MHz
OSCCON_SPLLEN = DISABLED    - 8Mhz OSC
--
enable_digital_io()                 -- make all pins digital I/O
pin_A4_direction = output      -- output osc/4
alias  clkout       is pin_A4      -- alias for clkout pin

forever loop
   clkout = ON
end loop


On Sun, Dec 15, 2024 at 9:02 AM vsurducan <[email protected]> wrote:

> Ok, pragma target clkouten is programming the configuration word as it
> should. Reading hex with a programmer it looks ok.
> However on the RA4 pin there is no clock/4.
>
>
> On Sat, Dec 14, 2024 at 1:15 PM vsurducan <[email protected]> wrote:
>
>> Hi Rob,
>> I'm trying to understand the PWM in PIC12F1572, for which the pwm library
>> can not be used.
>>
>> I need to see the system clock.
>> The problem is that I can not make it visible on clockout pin. The
>> following code should do it?
>>
>> include 12f1572                     -- target PICmicro
>> --
>> ;pragma target clock    32_000_000       -- oscillator frequency
>> pragma target clock    8_000_000       -- oscillator frequency
>> --
>> pragma target OSC      INTOSC_NOCLKOUT           -- internal oscillator
>> pragma target PLLEN    DISABLED                  -- PLL off
>> pragma target CLKOUTEN ENABLED                  -- clock output enabled
>> pragma target WDT      DISABLED                  -- watchdog
>> pragma target BROWNOUT DISABLED                  -- no brownout reset
>> pragma target LVP      ENABLED                   -- low voltage
>> programming
>> pragma target MCLR     EXTERNAL                  -- external reset
>> --
>>
>> OSCCON_SCS = 0                      -- select primary oscillator
>> OSCCON_IRCF = 0b1110                -- 8 MHz
>> ;OSCCON_SPLLEN = ENABLED               -- software PLL on   8x4=32MHz
>> OSCCON_SPLLEN = DISABLED    - 8Mhz OSC
>> --
>> enable_digital_io()                 -- make all pins digital I/O
>> pin_A4_direction = output ; output osc/4
>>
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qtqos%3DsRusP0SVrcELXKuOOgCgETpza6cW_v4vWj4%3DwmA%40mail.gmail.com.

Reply via email to