Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 25th May 2005, 05:33 PM   (permalink)
Default PIC and multiple serial devices

Is there a good way to do multiple PIC devices on a serial bus? They're devices I'd design, so I have an ability to do some nonstandard things.

I assume one PIC could transmit to multiple devices in parallel, and each device would just look for a byte string that tells it the stream is intended for that device or not. Correct?

Now on the other issue is some devices will need to return data. Of course there cannot be two on the bus at the same time. Can the PIC put just its transmitter in tristate and later switch to driving the line while not affecting the receiving portion, without any glitches?

Is this practical?
Oznog is offline   Reply With Quote
Old 25th May 2005, 06:15 PM   (permalink)
Default

Hi Oznog

I've done something along the lines of what you're thinking...

This was with multiple 16F84's (20 of em) where I used RS232 comms from a PC, all the PICs were identical except each had a 'personality' byte numbered from 0 upwards. So each command from the PC addressed a particular PIC which would then respond with a multibyte string. Since the PC was the master and all PICs slaves there was never any contention.

You may want to look at I2C enabled devices which will I think do exactly what you require and a similar scheme to that above could be easily implemented.

Best of Luck

Ed
EdwardM is offline   Reply With Quote
Old 25th May 2005, 07:35 PM   (permalink)
Default

Thanks, I've actually been using I2C but the cable length is long and will get longer if I add more devices. The PIC has a lot higher current sink capability than the I2C spec requires and thus can drive longer than spec cable lengths, but I'm still pushing it, and can't put an I2C EEPROM on there because it can't sink enough current to meet timing on that cable length.
Oznog is offline   Reply With Quote
Old 25th May 2005, 08:01 PM   (permalink)
Default

Quote:
Originally Posted by Oznog
Thanks, I've actually been using I2C but the cable length is long and will get longer if I add more devices. The PIC has a lot higher current sink capability than the I2C spec requires and thus can drive longer than spec cable lengths, but I'm still pushing it, and can't put an I2C EEPROM on there because it can't sink enough current to meet timing on that cable length.
What is your planed length of cable? Also do you think that it's not enaugh if PIC is sinking 20mA?
__________________
"I share, thus I am"
Jay.slovak
Read this!
ICD2 Clone
Best PIC/DsPIC Bootloader

Read my Inchworm ICD2 review!
Jay.slovak is offline   Reply With Quote
Old 25th May 2005, 08:56 PM   (permalink)
Default

You could try looking for "PICNET USB", a PIC networking scheme which uses USB, which also includes an older system that uses serial connections.

The link I have here doesn't work at the moment though?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 25th May 2005, 09:05 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
You could try looking for "PICNET USB", a PIC networking scheme which uses USB, which also includes an older system that uses serial connections.

The link I have here doesn't work at the moment though?.
Uff, USB for 16F84... sounds complicated :lol:
__________________
"I share, thus I am"
Jay.slovak
Read this!
ICD2 Clone
Best PIC/DsPIC Bootloader

Read my Inchworm ICD2 review!
Jay.slovak is offline   Reply With Quote
Old 25th May 2005, 09:12 PM   (permalink)
Default

Quote:
Originally Posted by Jay.slovak
The link I have here doesn't work at the moment though?.
Uff, USB for 16F84... sounds complicated :lol:[/quote]

It's not for the 84, the USB section uses the 16C745 USB PIC, but the older serial version is fine with the 84.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 25th May 2005, 09:19 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Quote:
Originally Posted by Jay.slovak
Quote:
The link I have here doesn't work at the moment though?.
Uff, USB for 16F84... sounds complicated :lol:
It's not for the 84, the USB section uses the 16C745 USB PIC, but the older serial version is fine with the 84.
OK, that's much better! But isn't that 16C745 an old PIC?

LOL USB and 16F84... :shock:
__________________
"I share, thus I am"
Jay.slovak
Read this!
ICD2 Clone
Best PIC/DsPIC Bootloader

Read my Inchworm ICD2 review!
Jay.slovak is offline   Reply With Quote
Old 25th May 2005, 10:01 PM   (permalink)
Default

Hi Y'all

really it all comes down to the data rate necessary to solve the original problem, if it's simply a matter of taking in data from multiple, slow speed sensors then the data rate can be equally slow. If however, there are a number of subsystems which require action *NOW* then the bandwidth requirement is that much greater and requires every part of the system to be fast or faster. Bearing in mind that PIC's generally have a max clock of a fairly pedestrian 20MHz, let's lay back and smell the coffee

Ed 8)
EdwardM is offline   Reply With Quote
Old 25th May 2005, 10:05 PM   (permalink)
Default

Quote:
Originally Posted by EdwardM
Hi Y'all

really it all comes down to the data rate necessary to solve the original problem, if it's simply a matter of taking in data from multiple, slow speed sensors then the data rate can be equally slow. If however, there are a number of subsystems which require action *NOW* then the bandwidth requirement is that much greater and requires every part of the system to be fast or faster. Bearing in mind that PIC's generally have a max clock of a fairly pedestrian 20MHz, let's lay back and smell the coffee

Ed 8)
What, you think that's slow? That's enaugh for 1Mbit SPI bus... What are the sensors sensing, that it requieres so much bandwidth?
__________________
"I share, thus I am"
Jay.slovak
Read this!
ICD2 Clone
Best PIC/DsPIC Bootloader

Read my Inchworm ICD2 review!
Jay.slovak is offline   Reply With Quote
Old 25th May 2005, 10:10 PM   (permalink)
Default

Hi

Quote:
What, you think that's slow? That's enaugh for 1Mbit SPI bus... What are the sensors sensing, that it requieres so much bandwidth?
Ptah!

I should know already, ask Oznog. But I guess he has a datarate/distance problem

:lol:

Ed
EdwardM is offline   Reply With Quote
Old 25th May 2005, 10:13 PM   (permalink)
Default

Quote:
Originally Posted by EdwardM
Hi

Quote:
What, you think that's slow? That's enaugh for 1Mbit SPI bus... What are the sensors sensing, that it requieres so much bandwidth?
Ptah!

I should know already, ask Oznog. But I guess he has a datarate/distance problem

:lol:

Ed
You know, that the greater distance, the slower datarates are available?
__________________
"I share, thus I am"
Jay.slovak
Read this!
ICD2 Clone
Best PIC/DsPIC Bootloader

Read my Inchworm ICD2 review!
Jay.slovak is offline   Reply With Quote
Old 25th May 2005, 11:38 PM   (permalink)
Default

Hiya Oznog,
Eh mate have ya thought of going wireless? Those 433mhz devices are getting pretty cheap like over here in Oz there only $8 each and there's a heap of info out there to get started. Once I get me shed finished I'll finally be able to start a few projects that are on the back burner and 1 of them a is a wireless system for checking the tank levels for my water storage tanks.( it's too far to walk now knowing I can make sumthing to keep me in front of the footy game and still be working hahaha)

Cheers Bryan
__________________
" The only way to avoid human error is to avoid the use of humans"
bryan1 is offline   Reply With Quote
Old 26th May 2005, 07:42 AM   (permalink)
Default

I guess the harness is around 6 ft right now, if I added more devices, it could easily double. I've had it running on I2C for awhile now with some relatively low ohm pullup resistors.

I'm keeping this low power in sleep mode, there is no "off" switch and the bus should be able to wake the part up. I2C line driver chips would probably present a problem here, plus there's just no room on the board. The power consumption when running is not such an issue though.

I can't add the I2C EEPROM with the bus loaded with so much more capacitance than spec though. It's unlikely the EEPROM has enough driving capability that its response would meet the timing spec.

So I was toying with the idea of serial again, which generally should have been the logical choice.

Bandwidth requirement is not so great, I already set it at a lower speed.
Oznog is offline   Reply With Quote
Old 26th May 2005, 08:18 AM   (permalink)
Default

Quote:
Originally Posted by Jay.slovak
OK, that's much better! But isn't that 16C745 an old PIC?
The 17C745 series WERE the only USB PIC's available, although MicroChip have very recently brought out some new 18F FLASH ones.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 05:52 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.