Continue to Site

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.

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

Linking PICS

Status
Not open for further replies.

GatorGuy

New Member
We are looking to build a board with several 16F628A's on it. The main one will be connected to a PC's serial port. Another one is going to control a LCD. Then there will be several PICS to control relays and temp sensors. I would like to connect the main PIC to the other PIC's I/O pins to either send data/commands or to retrieve data such as temps. Could anyone show me examples of how this is done and maybe some assembly examples? Any help would be great!
 
GatorGuy said:
I would like to connect the main PIC to the other PIC's I/O pins to either send data/commands or to retrieve data such as temps.

And what protocol are you intended to use for all these two way communications that happen between the chips, in real time? If you have no clue, forget the whole idea of connecting several PICs together.

What's wrong with just one PIC with lots of I/O pins like the 16F877, unless two way communication is the real objective of your project.
 
The goal of this project is to have hundreds of I/O options. Most of them will be inputs though. Most likely I will have a PIC for each function.

Would it be possible to use one of PIC-A's outputs to PIC-B's input to receive simple data? I am working off of a tutorial that uses a PC's serial port to send small strings of data to an input pin of a PIC. The PIC is programmed to "listen" and run a sub that matches the data received. I figured this could be done with two PICs. But that is why I am asking.
 
In the chip that's communicating with the PC I would use the hardware USART, in asynchronous mode, to communicate with the PC and make it the master of a synchronous serial bus to communicate with the other chips. This master would have to do the synchronous serial in software but that would be relatively simple and not time critical as it produces the clock signal. The other pics could use the hardware USART to do the synchronous serial.

You could use a simple polling protocol between chips. I.E. the master sends each slave chip commands and the slave chips only sends data when requested.

HTH

Mike.
 
It's easy enough to do, just a simple serial interface between the PIC's is all you need, you just have to decide on a protocol to use!. This obviously depends entirely on how it's all required to work together.

There was a website with a project called 'PICNet' which used serial connections, and 'PICNet USB' which used the 16C745's USB port, and 'networked' a number of PIC's together. Unfortunately the site seems to have disappeared?.
 
There's I2C on many PICs too. That manages it automatically so there will be no conflict between multiple transmitters, the protocol already handles addressing and in any case is an open-collector scheme that rules out electrical conflicts between transmitters.

Downside is it's not made for long runs (though it can sometimes be rigged to do so). You can find many non-PIC devices like ADCs, etc that work with I2C. The PIC implementation is a bit dicey too, it's not well documented and there are some known errata issues on a lot of parts.
 
Hi, sorry to hikack the thread...

I had prepared a thread which is very similar so I decided to just ride on this thread instead.

When I realized I needed mre I/O pins, I was thinking along the
serial connection of 16F628s. My only reason for not going to
the higher pinned PICs is because I'm a newbie to PICs and is relying
on the tutorials available in the web.

Now, if there a direct conversion if I developed a program starting
with the PIC16F84A and then converting it to PIC16F877?

Thanks in advance.
 
supremo said:
Hi, sorry to hikack the thread...

I had prepared a thread which is very similar so I decided to just ride on this thread instead.

When I realized I needed mre I/O pins, I was thinking along the
serial connection of 16F628s. My only reason for not going to
the higher pinned PICs is because I'm a newbie to PICs and is relying
on the tutorials available in the web.

Now, if there a direct conversion if I developed a program starting
with the PIC16F84A and then converting it to PIC16F877?

For a start you shouldn't really use the 16F84!, it was replaced years ago by the higher spec and cheaper 16F628.

However, BOTH are almost completely compatible with the 16F877, all of them use EXACTLY the same 14 bit core. The only differences are due to the hardware extras on the different devices.

I suggest you have a look at my tutorials, which use the 16F628 and 16F876/7 - I also give details of the very slight changes required between the two processors.
 
Contra to what most people state, the 16F628 is not a good replacement for the 16F84. The 16F628 cannot run unmodified 84 code yet there are many pics that can. The 16F877 can run unmodified 84 code. Just pretend it's a 84 with lots of I/O ports.

Mike.
 
Pommie said:
Contra to what most people state, the 16F628 is not a good replacement for the 16F84. The 16F628 cannot run unmodified 84 code yet there are many pics that can. The 16F877 can run unmodified 84 code. Just pretend it's a 84 with lots of I/O ports.

Mike.
I think 628 is a better replacement for 84 than 877. Try ti fit 16F877 in the same socket as 84 :lol: , And to add to lines of code into 628 is not a big deal!
 
Pin wise you are right. Code wise you're wrong.

The poster asked about converting from 84 to 877 - there is no (software) conversion required.

Plus, there are many 18 pin pics that can run unmodified 84 code.

Mike
 
Pommie said:
Contra to what most people state, the 16F628 is not a good replacement for the 16F84. The 16F628 cannot run unmodified 84 code yet there are many pics that can. The 16F877 can run unmodified 84 code. Just pretend it's a 84 with lots of I/O ports.

Sorry? - the 16F628 is the official MicroChip replacement for the 16F84, and has been for many years - it's uses EXACTLY the same 14 bit core, and there's even a migration document which tells you exctly what slight differences there is!.

The only 'modification' required to the code is to add two lines that disable the comparators - this is extremely trivial to do, and well documented. The 16F877/6 requires MORE changes to 84 code to allow it to run, at least four lines to turn the analogue inputs off (as it requires bank switching).

So contrary to what you appear to believe?, the 628 is the perfect replacement for the 84 - as it was designed to be!, and certainly closer than the 877.

If you want a version with analogue inputs?, try the 16F819 and 16F88, these are 18 pin but have analogue inputs. As with the rest they use the same 14 bit core, and are trivial to use in place of a 16x84.
 
Nigel Goodwin said:
Pommie said:
Contra to what most people state, the 16F628 is not a good replacement for the 16F84. The 16F628 cannot run unmodified 84 code yet there are many pics that can. The 16F877 can run unmodified 84 code. Just pretend it's a 84 with lots of I/O ports.

Sorry? - the 16F628 is the official MicroChip replacement for the 16F84, and has been for many years - it's uses EXACTLY the same 14 bit core, and there's even a migration document which tells you exctly what slight differences there is!.

The only 'modification' required to the code is to add two lines that disable the comparators - this is extremely trivial to do, and well documented. The 16F877/6 requires MORE changes to 84 code to allow it to run, at least four lines to turn the analogue inputs off (as it requires bank switching).

So contrary to what you appear to believe?, the 628 is the perfect replacement for the 84 - as it was designed to be!, and certainly closer than the 877.

If you want a version with analogue inputs?, try the 16F819 and 16F88, these are 18 pin but have analogue inputs. As with the rest they use the same 14 bit core, and are trivial to use in place of a 16x84.
Pommie: Exactly as I said :lol:
 
Well, that will teach me to come in from the pub and start spouting.

While I didn't explain myself as well as I would have liked (call that wrong) I do feel that I have a point though. The 628 has these comparators that nobody uses. Had they not put the comparators in there then it would have run 84 code without any changes (recompiled with the inc files). AND, if the person that asked about the 877 used the additional ports instead of that inferior A port then it would run 84 code unchanged (I know, I'm reaching). Anyway, the person that asked about the 877 can be assured it will work.

Next time I'll wait till the morning.

Mike.
 
Pommie said:
Well, that will teach me to come in from the pub and start spouting.

While I didn't explain myself as well as I would have liked (call that wrong) I do feel that I have a point though. The 628 has these comparators that nobody uses. Had they not put the comparators in there then it would have run 84 code without any changes (recompiled with the inc files). AND, if the person that asked about the 877 used the additional ports instead of that inferior A port then it would run 84 code unchanged (I know, I'm reaching). Anyway, the person that asked about the 877 can be assured it will work.

Next time I'll wait till the morning.

Mike.
You have partial truth, but we were talkiing about Drop-in replacements, which 16F877 obviously isn't...

BTW: Good Night :wink:
 
Just had a quick look and I believe that the 16F87 is a better replacement for the 84 than the 628.

I am going to bed now.

Good night.

Mike.
 
Pommie said:
Just had a quick look and I believe that the 16F87 is a better replacement for the 84 than the 628.

I am going to bed now.

Good night.

Mike.
No it's not.... it is the new NanoWat PIC, which has more different HW than 16F84 or 16F628. But I use 16F87/88 as a main chip for new designs (instead of 16F628). :)
 
wow, that was heavy! :lol:

the reason that i started my codes with the 16F84 is because as I have mentioned most of the tutorials available are for that PIC. But I don't intend to run them using that chip. I'll have to modify the codes to the new chip once I got the basics of the program to work by adding more channels (output) to my program.

I've seen the code change guide from 16F84 (something to do with the starting address and switching off some functions), what about 16F84 to 16F877? Does anybody have a link I could check?

Thanks again.
 
supremo said:
wow, that was heavy! :lol:

the reason that i started my codes with the 16F84 is because as I have mentioned most of the tutorials available are for that PIC. But I don't intend to run them using that chip. I'll have to modify the codes to the new chip once I got the basics of the program to work by adding more channels (output) to my program.

I've seen the code change guide from 16F84 (something to do with the starting address and switching off some functions), what about 16F84 to 16F877? Does anybody have a link I could check?

Thanks again.

My tutorials have a page that shows how to switch between the 628 and 876/7, it's in the Hardware section, under the 876/877 processor board. The 84 may well have a different GPR starting address as well - it's been so long I can't remember what the 84's was?.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top