PDA

View Full Version : PICs on a bus . . . ?



RussMartin
- 31st August 2006, 09:26
Given: One PIC is "the boss", one port is defined as output. Some x others, "slaves", each having one port defined as input. They share an 8-bit parallel bus.

Any issues? And what is the fanout limitation?

Melanie
- 31st August 2006, 09:40
In theory, dozens... since the master PIC can sink/source 25mA and the slaves have relatively high impedance (2K-10K) inputs. However in practice this will depend on the Data Transfer Speed and the total loaded circuit capacitance. You 'may' need some Pull-Up's on the Bus. If you're breadboarding, you'll discover if it's needed, if you're laying down a PCB board as a starter, there's no harm in adding the holes for a SIL Resistor pack in case it's needed. I can confirm FOUR PICS on a (small two-wire) Bus without problems. Watch you don't use a Port on the Master which has an Open-Drain pin - otherwise you WILL need that external Resistor.

BobK
- 1st September 2006, 05:05
Hi Russ,

I recently built 2 systems that have 20 PICs reporting to 1 PIC on a 2 wire buss. One is Busy and the other is data. They work great!

Let me know if you need more info on this type of system.

BobK

RussMartin
- 1st September 2006, 06:26
Bob, I've sent you a PM on this so we won't clutter up the forum. I'll look forward to hearing from you.

Melanie, thanks for the reminder on pullup(s). I'm using the 16F87xA devices (so far), and the only open drain I see in the data sheet is RA4. Being a fussy creature of habit, I'll probably want to put 4.7K pullups on anything that resembles a parallel bus . . .

rhino
- 1st September 2006, 16:28
Sorry, but I had to chime in.... Does this sound like a bad Samuel L. Jackson movie to anyone else? Pics on a Bus..... Snakes on a Plane.

Jerson
- 1st September 2006, 17:27
Sorry, but I had to chime in.... Does this sound like a bad Samuel L. Jackson movie to anyone else? Pics on a Bus..... Snakes on a Plane.

Just taking it a lil' further, how about a Rhino in soup? ;)

Hey I'm only jokin. So, don't get serious.

Jerson

Archangel
- 6th September 2006, 10:08
Bob, I've sent you a PM on this so we won't clutter up the forum. I'll look forward to hearing from you.

All the jokes aside, . . .
Lots of Noobies out here looking to learn from posts such as this - It's not clutter to us, Thank You.

RussMartin
- 7th September 2006, 07:22
My apologies--I wasn't intending to be rude! I sent a private message to Bob merely to request more details. I'm sure he would be happy to share with all . . .

ibralfy
- 13th February 2010, 00:59
hi all

i need to read ac current via pic16f877a and display it to lcd
can you help me

thank u

Charles Linquis
- 14th February 2010, 00:05
Measuring AC current is not as easy as it seems. I assume that the voltage is something above 60V.

Although the voltage waveform of your AC might be a sine wave, the current waveform seldom is. Unless your load is purely resistive, you cannot measure current by taking a percentage of the peak value output of a current transformer or Hall-effect device. If you are measuring "mains" voltage, then measuring the current by sensing voltage drop across a resistor is probably not an option. A Hall-effect device is usually the best option.

So, you will probably need to measure RMS current.

In order to get decent accuracy, you will have to sample the current waveform at least 10 times in each half-cycle, multiply each sample value by itself (square it), then average the samples by adding the squares together over a period (at least one cycle) and dividing by the number of samples, and finally taking the square root of the average.

You *can* do this, and I don't want to sound like a broken record - but 18F parts are better at most everything!

That said, I have used an 18F8723 to measure 4 channels of RMS current with good accuracy using Allegro Hall-effect current sensors.
The chip was very busy, and was running at 40Mhz.

aratti
- 12th May 2010, 19:41
In order to get decent accuracy, you will have to sample the current waveform at least 10 times in each half-cycle, multiply each sample value by itself (square it), then average the samples by adding the squares together over a period (at least one cycle) and dividing by the number of samples, and finally taking the square root of the average.

Are you sure?

Al.

Charles Linquis
- 13th May 2010, 02:16
If you have a better idea, I'm open to it. Yes, you can sample slowly if you can tolerate a longer-term average (like you would need to display on an LCD). I realized that even with low sample rates, I would sample every part of the waveform eventually. But I needed an "electronic circuit breaker" that had to respond on a cycle-by-cycle basis.

I proved that I could respond in one cycle by connecting a bridge rectifier + resistor + FET across the load and connecting the gate of the FET to a pin on a PIC development board then bringing the the gate high for 17 ms. It worked and the circuits are in the hands of a happy (and very demanding) military customer.

Charles Linquis
- 13th May 2010, 05:15
I went back and read the entire thread, and realized I was incorrect when I told ibralfy that it was necessary to sample often (that was *my* requirement). Aratti, you are correct when you imply that you don't a high sample rate. 20 or 30 samples between each LCD update should be enough.

But ibralfy, if you sample slowly, you need to make certain that you aren't sampling at a sub-harmonic of the line frequency.