Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Which other device? Are you using PIC 1 to simulate the output behaviour of another digital device?
If you just want to know whether they are compatible, it should be fine. They can source or sink 25ma each (I think, without looking at data sheets) so as long as both are set up correctly, you shouldn't have a problem.
Again. I haven't looked at a data sheet recently.
If you're looking for fast and accurate information tranfser between the two though, why not make use of the USART? see the data sheet and Nigels tutorials...
Thanks for your input. The other devices are 2 Ultrasonic Range Finders, each on their own Printed Circuit Board (PCB). I won't need to send data streams between the 3 PICs so don't need the USART. Just need a logic (yes/no) connection.
I.E. The PCB with PIC1 and the PCB with PIC2 send/receive Ultrasonic. The timing from send to receive adjusts Pulse Width Modulation (PWM) to their respective motor. The PCB with PIC3 senses Infrared (IR) and needs to know whether PIC1 or PIC2 was adjusting the PWM at the time it detected the IR signal.
This is my first atempt to design an autonomous robot using PIC µControllers. The PCB with PIC1 will be mounted on the left, controlling the motor on the right and the PCB with PIC2 will be mounted on the right controlling the motor on the left. The Ultrasonic Range Finder (URF) adjusts the PWM, slowing down the motor according to the distance (ultrasonic send/receive timing) to the object detected. The closer the object, the slower the motor runs, thus steering away from the object. The URF has a range of about 24 inches. In the event it is unsuccessful at steering around an object the Infrared PCB with PIC3, which has a range of about 6 inches, will stop the robot before it runs into the object. PIC3 needs to know which way the robot was being steered so that when it processes the STOP and TURN it will know which way to turn. In the event both PIC1 and PIC2 are slowing down their respective motor when the IR detects an object straight ahead then it will need to process a STOP, turn 180° and reset PICs 1/2 so it operates as though it had just been turned on.
For instance, if it were going down a hallway. When it gets close to the end, both URFs would "see" the end of the hallway slowing the robot untill the IR detects that the wall is within 6 inches. Because both URFs were adjusting the PWM the robot (PIC3) would know to turn 180°.
Somehow I've only just noticed your reply! Sorry about that. Why are you using three PICs? It seems to me that you may be over complicating the matter somewhat?
If it is for the PWM that you are using PICs 1 & 2, you could consider other methods of control. For instance, if 8 bit resolution would be needed for the speed control, you could use three pins to convey the speed, through D/A converter to give an analogue reference for a motor controller? You could do this for both motors. You can still connect IR and Ultrasonics up and get all of the functionality from one uC, saving the need for three way comms?
This is just what popped into my head as a first solution to the comms thing. I'd be interested to find out how you get along, regardless which method you use!
I've learned a lot about µC's since I started this thread.
PIC1/2, 16F88's, are dedicated Tx/Rx ultrasonic signal, they then compile the data to get distance from object and send the 2-byte result via USART to PIC3, 16F877A, the master system controller. PIC3 has several other enviromental inputs both analog and logic. PIC3 uses all these data inputs to adjust PWM to the motors.