• 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.

PIC16f84-04/p network question.

Status
Not open for further replies.

Velvet Leopard

New Member
Hewwo, all. I was wondering. I am going to purchase two PIC micros (PIC16f84-04/p) and was wondering if any one out there knew how to use them in tandem. I want to make a robot brain with the two PICs working as one PIC. I believe I can do the programming, but I need to know of any important wiring or operational problems that might arise. Any help with tying the two PICs together would be more than apreciated. The leopard purrrrs deep.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Velvet Leopard said:
Hewwo, all. I was wondering. I am going to purchase two PIC micros (PIC16f84-04/p) and was wondering if any one out there knew how to use them in tandem. I want to make a robot brain with the two PICs working as one PIC. I believe I can do the programming, but I need to know of any important wiring or operational problems that might arise. Any help with tying the two PICs together would be more than apreciated. The leopard purrrrs deep.
There's no way to make 'two PIC's work as one PIC', but it's fairly easy to connect two PIC's together for a robot. You can simply link them via two pins with serial connections - and use them for different functions. One PIC could do all the motor functions and main control, the second PIC could do all the sensor functions.
 

Velvet Leopard

New Member
Thanks for the reply.

The leopard thanks you, Nigel, for the reply. I had the feeling that you couldn't make the two PICs work like one, but I still had to ask. I don't know everything after all. The leopard laughes. I thought of making one PIC work the motor functions and the other working the sensory functions, but I could have sworn there was a way to tie the PICs and make a program to work them, but I will take your word for it. I would like some more info on working a robot with the two PICs if it is ok. I would also like to learn more about designing efficient programs for the PICs. If anyone out there has alot of experience with these PICs, could you lend a paw to the leopard? Thanks alot for your help.
 

motion

New Member
Why employ two 4Mhz PICs when you can use a single 20Mhz PIC which operates 5 times as fast?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
motion said:
Why employ two 4Mhz PICs when you can use a single 20Mhz PIC which operates 5 times as fast?
The main advantage is in using modular construction, by separating control and sensor functions you can test and modify each section independently - knowing that you haven't accidentally upset something else. It also reduces the number of long connecting wires, if the sensors are at one end of the robot, and motor drivers at the other, you only need a couple of wires to go the length of the robot.

Speed isn't a problem in robots, usually just the opposite - a PIC spends most of it's life sat in loops wasting time, or sat waiting for a pin to change state.
 

Velvet Leopard

New Member
Thanks.

The leopard thanks you, Nigel, for your advice. I can see how using the two PICs separately for the sensory and motor functions makes the design and functions more efficient. Motion, I have not been in the hobby for long, so I didn't know about 20 Mhz PICs. I am new at the whole "PIC" thing. I do know if I can get the two PICs to run the bot, I can make some neat programs with them. Nigel, do you think you could show or tell the leopard how to tie the PICs to control the separate functions, yet still signal each other some how about the different inputs? The leopard greatly thanks your advice.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Re: Thanks.

Velvet Leopard said:
The leopard thanks you, Nigel, for your advice. I can see how using the two PICs separately for the sensory and motor functions makes the design and functions more efficient. Motion, I have not been in the hobby for long, so I didn't know about 20 Mhz PICs. I am new at the whole "PIC" thing. I do know if I can get the two PICs to run the bot, I can make some neat programs with them. Nigel, do you think you could show or tell the leopard how to tie the PICs to control the separate functions, yet still signal each other some how about the different inputs? The leopard greatly thanks your advice.
There are obviously many ways of doing it, but personally I tend to use a simple RS232 connection between the two PIC's. You can do this with just two I/O pins on each PIC - if you use 16F628's, the modern replacement for the 84, they also have hardware USART's which can make life easier.

You then need to decide how you are going to actually run the interconnection - there are basically two ways!. Either the motor controller sends a signal to the sensor controller saying 'please read sensors', and the sensor controller does so and returns the result - or the sensor controller reads the sensors all the time and send the results continually without being asked. Or you could use a combination of both.

The first option makes timing a lot simpler, the motor controller can check the sensors when it's not doing something else - the second option probably works best using interrupt routines. Don't forget, a 4MHz PIC takes only 1uS to execute most instructions - you can execute a huge number of PIC instructions before you even notice your robot moving.

I mentioned it before, and I'll mention it again, a PIC in a robot is going to spend the vast majority of it's time just wasting time.
 

motion

New Member
The main reason for recommending to put together everthing in a single PIC is because of the complex software required for a distributed PIC system to work. In addition to the basic control software, you also have to write and debug the communications software and protocols.

To a newbie in PIC programming, I would recommend you first try to make it work with one PIC first. If you choose to, you can employ the same modular software techniques in distributed PICs and let the modules communicate to each other within the same PIC.

Speed may not be an issue but if it becomes one, you can easily get 20Mhz parts to fix that problem. In many cases of motor control, the sensors are located near where the motors are and so it is best to lump sensors with motor control. However, if multiple motors are used, you can now employ multiple PICs, with each PIC handling a motor and its associated sensors.
 

Velvet Leopard

New Member
Thankies for the advice.

The leopard thanks you, Nigel and Motion. You have given me some good insight into my subject. I will try only one PIC at first then experiment with the two. The only reseaon I am have ing to use PICs is because the project in my books use that model and I don't think it can be substituted. I have only a couple more questions concerning the controlers. First, how would I get a RS232 for the design and how do I work it? And second, where can I find some new up to date PICs and other kinds of controlers to use? Thankies for all your help. he leopard purrrrs and swishes his long heavy tail.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Re: Thankies for the advice.

Velvet Leopard said:
The leopard thanks you, Nigel and Motion. You have given me some good insight into my subject. I will try only one PIC at first then experiment with the two. The only reseaon I am have ing to use PICs is because the project in my books use that model and I don't think it can be substituted. I have only a couple more questions concerning the controlers. First, how would I get a RS232 for the design and how do I work it? And second, where can I find some new up to date PICs and other kinds of controlers to use? Thankies for all your help. he leopard purrrrs and swishes his long heavy tail.
For RS232 have a look at my PIC tutorials at http://www.winpicprog.co.uk. PIC wise it's generally better to use EEPROM/FLASH chips as they are easily and quickly re-programmable. The 16F628 is a nice choice, as it's an 18 pin chip with 16 available I/O pins and has an internal oscillator. For a larger PIC the 16F876 is 28 pin (but in a slimline DIL case), and has the avantage (for robot use) of having two hardware PWM modules - ideal for feeding a robot.
 

motion

New Member
First, how would I get a RS232 for the design and how do I work it?
A pair of RS232 line driver and receiver like the MAX232 are normally connected to the RX and TX pins. Programming examples are found extensively online like Nigel's. What programming language do you intend to use? Most sample code is supplied in assembly language.

And second, where can I find some new up to date PICs and other kinds of controlers to use?
I have worked with PIC16F87X series but I would recommend your try to get a hold of the PIC18FXX2 series (F242,F252,F442,F452). They are pin compatible with the F87X series but have more power, memory capacity and speed.
 

Velvet Leopard

New Member
Where can I get it?

Where can the leopard obtain a PIC18FXX2? I will get it and do as you say to learn it. I can learn any language nessecary for microcontroller usage. Thanks.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top