[sdiy] PICs sharing pins and clock

Simon Brouwer simon.oo.o at xs4all.nl
Sun Sep 25 11:42:20 CEST 2005


Hi Fabio,

At 08:29 25-9-2005, fmg wrote:
>To the pics gurus,
>
>Is this possible?  I mean, can two (or more) PICs work together, one
>with one of its pins working as output and connected to a second one
>configured as input, both sharing a common external clock?
>
>Example (for better clarity): pin RB0 (from PIC #1) as output and directly
>connected to pin RA0 (from PIC #2) as input...
>
>instruc.
>  cycle       pic #1                        pic #2
>------------------------------------------------------      (-x- = don't care)
>   Tn           -x-                           -x-
>  Tn+1      incf   portB,1   -------->   btfsc   portA,0
>  Tn+2          -x-                      goto XX
>  Tn+3          -x-                      goto YY
>
>...will pic #2 go to XX if RB0 from pic #1 changes from 0x00 to 0x01 ?
>
>The 16f84a's datasheet is a bit confusing (or I'm not interpreting it
>correctly). I'm also not sure if this is the correct place to ask (even
>if this is for a synth project)
>
>Any light would be appreciated, TIA

Running two PICs from a single external clock will not be the problem, but 
you have to make sure that their programs start at exactly the same moment, 
so in any case the up going edge on MCLR of both PICs should be 
synchronized with the clock, and on the right phase of the clock too (you 
would have to investigate or experiment further).

Also, I would time the btfsc instruction *after* the incf instruction, like 
so:
  Tn          incf   portB,1         -x-
  Tn+1         -x-                        btfsc  portA,0
  Tn+2          -x-                      goto XX
  Tn+3          -x-                      goto YY

By the way, on www.microchip.com there are excellent forums where you could 
discuss such subjects in more detail.


Vriendelijke groet,
Simon Brouwer.

 >>> nl.openoffice.org <<<




More information about the Synth-diy mailing list