Question:

How can i use two PIC micro controllers working synchronic?

by  |  earlier

0 LIKES UnLike

I have a circuit with two PIC micros and they are moving some motors . i want them two move motors in a same time. help me what can i do ? ( can i use common crystal ?) also i am using 4MHz crystal.

 Tags:

   Report

2 ANSWERS


  1. By the time the 4 MHz crystal signal is divided down inside the PIC to an individual set of instructions for motor motion, the 2 PICs would be close enough to each other if they used separate 4 MHz crystals.   I doubt you will be sending any commands to an winding driver every 250 nanoseconds (1/ 4MHz).  The driver transistors or MOSFETs probably won't even respond in less than a couple of microseconds.

    What you need to do is to use a port output from one PIC to drive an interrupt on the other PIC, and vice-versa.  In real-time-operating systems, these are called semaphores.  Having the 2 PICs 'talk' to one another constantly will keep them in synchronization.  Each of the interrupts should force the PICs into a known state.  A timer should time out to drive the interrupt in the other PIC.  That way, if the frequency is off by a few percent, it can be compensated for in time with the timer.

    .


  2. you have to drive them with the same clock signal but not directly by the same crystal. better search the web

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.