PICDEM 2 Plus 32khz Clock Time PIC

(instructions, reset, WDT, specifications...) PIC12F6xx, PIC16Fxxx, PIC16F6x, PIC16F7x

PICDEM 2 Plus 32khz Clock Time PIC

Postby CaliforniaSlacker » Tue Nov 17, 2020 5:22 pm

User Guide lists the 32khz clock as one of four oscillator options.

For the 16F84A what oscillator word should we use in config line?

Thanks!

EDIT Here is the text from manual.

A.6 OSCILLATOR OPTIONS
• RC oscillator (2 MHz approximately) supplied. This oscillator may be disabled by
removing jumper J7.
• Pads provided for user-furnished crystal and two capacitors.
• Removable, 4 MHz, canned oscillator.
• 32.768 kHz (watch-type) crystal for Timer1.

Looks like you disable by jumper the 2MHZ RC oscillator then remove the 4MHZ canned oscillator.

Then hope Microchip routes the 32khz clock signal to the right pin on the 18 pin socket.

16F84A oscillator options do not have a 'clock' or timer word. 16F818 does have one that sounds more like it.

Will try a couple things.
CaliforniaSlacker
 
Posts: 21
Joined: Mon Feb 19, 2018 8:01 am

Re: PICDEM 2 Plus 32khz Clock Time PIC

Postby ric » Tue Nov 17, 2020 8:25 pm

Note the text says:
32.768 kHz (watch-type) crystal for Timer1.
(my bolding. Those words are important.)

The PIC16F84A does not have a Timer1.
The PIC16F818 does, and if you look in the Timer1 chapter, you will see that Timer1 has its own oscillator circuit that can use a crystal connected to pins T1OSI/RB7 and T1OSO/RB6.
That is what this text is referring to.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: PICDEM 2 Plus 32khz Clock Time PIC

Postby CaliforniaSlacker » Tue Nov 17, 2020 9:34 pm

Thanks Ric

Did one thing.Powered up board with jumper on for RC circuit 2MHZ. LED lit up and stayed on.

THEN. Disconnected jumper.LED went off.BUT.Powered up board board again and in about a second LED came on.

Seems like it defaulted to internal @32khx oscillator.

Well that is fine that the 16F818 likes its @32khz internal oscillator the best.

BUT.We are going to try the 16F84A with a 32khz 4 leg oscillator (canned) we forgot we had.

Just make the config LP_OSC and hope the canned oscillator works.

It stays in line with most of code in book.Which is for 16F84 with 32khz oscillator.Book says use 32khz barrel oscillator(2 pin) with capacitors though.

Sure hope this works.
CaliforniaSlacker
 
Posts: 21
Joined: Mon Feb 19, 2018 8:01 am

Re: PICDEM 2 Plus 32khz Clock Time PIC

Postby CaliforniaSlacker » Tue Nov 17, 2020 10:25 pm

Okay.The 16F84A and the 32khz canned oscillator works as far as we can tell.

Had to comment out the calls for the delays because with them in it did not blink anyway.

I think that ZEROBIT passing maybe the problem.

Can we just name the bit in the command? Status,2

Thanks!

Here is the code.

Code: Select all
;16F84A Light an LED. Not blink it, just light it. For now.Add blinking.

ZEROBIT       EQU 2             ;means ZEROBIT is bit 2.

   list      p=16F84A            ; list directive to define processor
   #include <p16F84A.inc>        ; processor specific variable definitions

   __CONFIG   _CP_OFF & _WDT_ON & _PWRTE_ON & _LP_OSC

;**********************************************************************
      ORG     0x000             ; processor reset vector
        goto    START             ; go to beginning of program

;**********************************************************************


   
;SUBROUTINE SECTION.
;1 second delay.

DELAY1    CLRF    TMR0    ;START TMR0.
LOOPA    MOVF    TMR0,W    ;READ TMR0 INTO W
      SUBLW    .32    ;TIME - 32
      BTFSS    STATUS,ZEROBIT ; Check TIME-W=0 
      GOTO    LOOPA    ;Time is not=32
      RETLW    0       ;Time is 32, return



; remaining code goes here

START   BSF    STATUS,5          ;Turns to Bank1

      MOVLW    b'00011111'         ;5bits of PORTA are I/P
      MOVWF    TRISA

      MOVLW    b'00000000'
      MOVWF    TRISB             ;PORTB is OUTPUT

      MOVLW    b'00000111'       ;Prescaler is /256
      MOVWF    OPTION_REG         ;TIMER is 1/32 secs.

      BCF    STATUS,5          ;Return to Bank0.

      CLRF    PORTA             ;Clears PortA.
      CLRF    PORTB             ;Clears PortB.

;Program starts now.

BEGIN    BSF    PORTB,0          ;Turn ON B0
      ;CALL    DELAY1             ;Wait 1 second
      ;BCF    PORTB,0          ;Turn OFF B0.
      ;CALL    DELAY1             ;Wait 1 second

      GOTO    BEGIN             ;Repeat


      END                        ;YOU MUST END!!

CaliforniaSlacker
 
Posts: 21
Joined: Mon Feb 19, 2018 8:01 am


Return to 14-Bit Core

Who is online

Users browsing this forum: No registered users and 10 guests

cron