PDA

View Full Version : serout2 using Open Inverted



Pimentel
- 14th November 2008, 17:12
Hi,

I have an aplication runing ok with a PIC 16F877A conected to PC (N9600 = 16468 using serout2). Now, I want to put a second PIC together e after the last PIC (3 in all) but I don`t now how to do it.
Need I to use a ON mode (ON9600 = 49236 using serout2) ? Is necessary to put a pull up or pull down resistor? Can I to conect the 2 pins of the PIC together and then to the pin2 of DB9 to send to PC? If the 2 PICs send data to PC in same time, what happen?

Thanks for your help
Pimentel

mister_e
- 14th November 2008, 17:27
No you don't need to use ON mode, you can use N or T modes without much problems.

Is necessary to put a pull up or pull down resistor?
not really with T or N mode.

Can I to conect the 2 pins of the PIC together and then to the pin2 of DB9 to send to PC? If the 2 PICs send data to PC in same time, what happen?
Some data collision in front ;) I would probably dedicate a PIC to send the data to the PC.

BUT, there's also another option, which would allow you to connect two serial output pins together. What you need to use is a kind of Busy line. This is a line connected between your PIC. This tells that you're actually sending data to the PC.

Start with both PIC output pin set to input, with a pull-up/down (depending of your actual setup), when you want to send some data to the PC, you check the level of the Busy line (0 or 1), if ok(not busy), set this line to busy level, set your Serial output to output, send your data, set that pin to input, release the busy line, and you're done.

Wait a minute... ON mode could be interesting here ;)

Charles Linquis
- 15th November 2008, 01:58
If you connect the serial outputs of two PICs together, you should always use the OPEN mode. Use a pull-up to Vcc. 3.3K is a good choice for a value.

Pimentel
- 16th November 2008, 12:29
Thanks Charle and Steve!

I tested wiring the 2 pins of 2 PICs together with a 4K7 pul up resistor, but it did not function. Then I removed the electrical resistance and I got success!
I used ON mode (serout2 portb.0,49xxx) <=> ON9600

Thanks again

Pimentel

Charles Linquis
- 16th November 2008, 17:17
Something is strange then, because when you are using the device in the OPEN mode (if you truly are), then there is no way it will work without a resistor connected to the wire between the PICs and to Vcc. Note that the OPEN mode only makes sense on the SEND side (SEROUT).

That is, if you have PICs #1 and #2 both sending data to PIC #3, then Pic #1 and #2 should be in the OPEN mode. PIC #3 does not have to be in the OPEN mode to receive the data (but all devices must be either TRUE or INVERTED), and you must have a pull-up on the wire that connects the output of PIC#1, PIC#2 and the input of PIC#3.

Pimentel
- 17th November 2008, 11:15
Hi,

Explaining better… I have 2 PICs sending data for a radio configured for 9600, N, 8,1. When I insert a 4k7 resistor to VCC the circuit fail.
Now, as attached figure always functions!

Bruce
- 17th November 2008, 13:11
For inverted serial the TX pin should idle low, so a pull-down resistor would be
required. If you were using true mode then a pull-up resistor would be needed.

Pimentel
- 18th November 2008, 09:52
Hi Bruce,

Now I understood. I go to insert a pull down resistor then!

Thanks again

Pimentel