Searching \ for '77 KHz burst (was Re: Surface mount pics)' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: '77 KHz burst (was Re: Surface mount pics)'.

Truncated match.
PICList Thread
'77 KHz burst (was Re: Surface mount pics)'
1995\11\01@113028 by Mike Keitz

flavicon
face
Steve Addison writes:
>I am trying to generate a 77Khz signal from a surface mount pic in 10ms bursts.
>The way I have attempted to do it at the moment I require the program
>counter to increment every 0.5uS which means I need a resonator speed of
>8MHz - as the PC is incremented at a quarter of the pic clock speed.
>
>All the SMD pics in the (Farnell) catalog are 4MHz devices - and here's the
>stupid question - will I be able to use an 8MHz resonator?

Probably.  You won't have any recourse if it doesn't work, of course.


>If anyone has any sugestions on how to achieve a 77KHz output (in 10mS
>bursts) for an SMD 4MHz pic I would love to hear them!

OK, I'll take a stab at it:

77KHz = approx 13 cycles at 4 MHz X1 (actual freq will be 1E6/13 = 76.9231 KHz.
10 ms = 770 cycles of 77 KHz signal.  Since the rate is 13 cycles, it's
tough to make a square wave using exactly a 4 MHz clock.  In the program
below, the signal will be high for 6 instruction cycles and low for 7.
Since there is some extra time in the routine, slower PIC clocks may be used
and then the waveform made symmetrical by removing some NOPs.  I'll leave
this for the programmer.  It appears that a 77K*12*4 = 3.696 MHz clock would
be ideal for making square waves, by removing the NOP after burstsl below.

burst
       movlw   .2              ;2 byte cycle counter - initialize to 770 dec.
       movwf   ccntl           ;Need 2 RAM variables.
       movlw   .3
       movwf   ccnth
burstfl
       nop                     ;Equalize loop time if only low byte dec.
       nop
burstsl
       nop                     ;May be removed for slower clocks.
       bsf     PORT_B,0        ;Set output high. (can use any port here)
       goto    $+1             ;2- cycle NOPs.
       goto    $+1
       nop
       bcf     PORT_B,0        ;Output was high for 6 cycles, now low.
; From here, always 5 cycles back to burstsl.
       decfsz  ccntl
       goto    burstfl
       decfsz  ccnth
       goto    burstsl
;Fall thru to here when burst is done.

This code is not tested or guaranteed.  Use at your own risk.

-Mike

1995\11\01@115558 by Paul Greenwood

flavicon
face
Steve Addison writes:
>I am trying to generate a 77Khz signal from a surface mount pic in 10ms bursts.
>The way I have attempted to do it at the moment I require the program
>counter to increment every 0.5uS which means I need a resonator speed of
>8MHz - as the PC is incremented at a quarter of the pic clock speed.
>
>All the SMD pics in the (Farnell) catalog are 4MHz devices - and here's the
>stupid question - will I be able to use an 8MHz resonator?

I know it takes another part but you might consider using a 555 timer tuned
to 77KHz.  You could then gate the signal with a nand gate or something.  You
MAY be able to power the 555 from your I/O pin so that you turn the 555 on/off
to make your bursts.  I personally would let the PIC do it like you're wanting
to do but I wanted to suggest this.

--

           -- Paul Greenwood --  (spam_OUTpabloTakeThisOuTspamaustin.ibm.com)

Succumb to natural tendencies.  Be hateful and boring.

1995\11\01@132320 by Andrew Warren

face
flavicon
face
Mike Keitz <.....mkeitzKILLspamspam@spam@BEV.NET> wrote:

{Quote hidden}

   Mike:

   Won't work.  Instead of generating a 10-ms burst, your code will generate on
ly
   a 6.67-ms burst.  To make your DECFSZs work properly, you'll need to load
   ccnth with 4, not 3.

   If 9.974 ms is close enough, the following bit of code will do the job using
   only one register:

           CLRF    COUNT

       L1: MOVLW   00000001B   ;The "1" in W corresponds to the PORTB bit that
           GOTO    $+1         ;we'll be toggling.  This example is for PORTB,0
.

       L2: XORWF   PORTB
           BTFSC   PORTB,0
           GOTO    L1

       L3: GOTO    $+1
           NOP
           XORWF   PORTB
           BTFSC   PORTB,0
           GOTO    L3

       L4: GOTO    $+1
           NOP
           XORWF   PORTB
           BTFSC   PORTB,0
           GOTO    L4

           DECFSZ  COUNT
           GOTO    L2

   -Andy

--
Andrew Warren - fastfwdspamKILLspamix.netcom.com
Fast Forward Engineering, Vista, California

1995\11\02@055351 by Andrew Warren

flavicon
face
Mike Keitz <.....mkeitzKILLspamspam.....BEV.NET> wrote:

{Quote hidden}

   Mike:

   Won't work.  Instead of generating a 10-ms burst, your code will generate on
ly
   a 6.67-ms burst.  To make your DECFSZs work properly, you'll need to load
   ccnth with 4, not 3.

   If 9.974 ms is close enough, the following bit of code will do the job using
   only one register:

           CLRF    COUNT

       L1: MOVLW   00000001B   ;The "1" in W corresponds to the PORTB bit that
           GOTO    $+1         ;we'll be toggling.  This example is for PORTB,0

More... (looser matching)
- Last day of these posts
- In 1995 , 1996 only
- Today
- New search...