PDA

View Full Version : 2 cable and more pic



SuB-ZeRo
- 26th May 2005, 22:51
Let me tell u more of my problem.
Just think 10 or more pic and a master pic to check others.
The slaves will do their jobs but when the master asks it will answer the master.
For exemple lets give names to the slaves as S1,S2...S10 and the master will be MAS
the MAS is asking to the S2
MAS=S2 re u there?
S2 = yes i am here and online
MAS=what is the count?
S2= 100
MAS=ok i got the count clear the count.
S2=count cleared!!!!
then.....
MAS=S4
MAS=S5....
NOW THE REAL QUESTION
is it possible to do all of these in 2 wire lines?

mister_e
- 26th May 2005, 23:01
answer yes...

here is something to start...
http://www.picbasic.co.uk/forum/showthread.php?t=1192

SuB-ZeRo
- 26th May 2005, 23:50
I think u understand me wrong i am trying to explain like the picture...
for exemple slave1 =S1
S1 will read the main line and will wait call for S1
all the pics must connect to the main line.

ronjodu
- 27th May 2005, 01:34
Have you considered CAN controllers? I just aquired some samples from Microchip to do that same thing. No progress yet however.

SuB-ZeRo
- 27th May 2005, 02:58
Yes that's right.I am trying to do that.It's not impossible imposible things re that we can't do.And i will find a solition if i find i will share.

mister_e
- 27th May 2005, 03:51
you don't need to get some CAN stuff for that. TWO WIRES only

One scheme... there's a thousands other way but.. I2C could be interesting also

1 Busy line
1 TX/RX line


Master enable the busy line
all slave listen the Master for a x timeout delay
Master message done, Master disable busy line and wait reply of a Slave
Slave enable busy line and talk to Master


That imply to switch I/Os to input and output but this work...

OR if you want to do everything more easy.... another scheme


1. TX (From master TX to all slave RX)
1. RX (From all slave TX to Master RX with diode mixer and pull down/pull up resistor depending of your serial mode (inverted or true driven))

Ceug2005
- 27th May 2005, 05:22
SuB-ZeRo.
Read more about "1 wire network ".
i think ... is possible to give a ID to S1/S2/....S10 and problem is solved.
line 1 - lets say - ground
line 2 - data.


All the rest is pure imagination.

Melanie
- 27th May 2005, 09:14
In it's simplest form, connect ONE wire between the comms pin of your choice on ALL your PICs. The Master has a LOW VALUE Resistor (say between 1K and 4K7) between it's comms pin and Vdd. All pics idle in RECEIVE (Input) mode.

MASTER sends a Transmit Request to the SLAVE of it's choice. The SLAVE will then reply accordingly. All PICs on completing communication return to idle in RECEIVE. No problems here. SLAVE addresses can be individually coded into the SLAVE software, or, more commonly, assign some pins on the PIC (in your case for ten SLAVES you will need four pins) to designate your SLAVE address. The SLAVE will read those pins at power-on and assign its own address accordingly - this approach is more sensible as then you only have to write ONE piece of code that will fit all the SLAVES.

If the SLAVE PICs are remotely located (ie in other parts of the building or in external equipment), then you will need a more sophisticated interface, as 0-5v one-wire lines will have a transmission limit. Try LOW baud rates (eg 300-1200 baud) at first. The upper limit will be determined by the pull-up Resistor and the number of PICs loading the comms line.

SuB-ZeRo
- 28th May 2005, 00:29
Yes i did 1 simple network
and this is how
i give all the slaves a nick like S1 S2...
all of them counting the signals in the counting codes i guide the listening codes on each counting codes.
program runs like this (but still have problems)
counting_loop:
count the signals
dig1 dig 0 (display the first digit in 7 segment)
dig2 dig 1 (display the second digit)
dig3 dig 2 (display the third digit)
look for data include S1
if data include S1 then goto comminucate
goto counting loop
comminucate:
out msg i am here
if data include count? then send data [the count]
pause 100 'for MASTER and wait for OK!
if data include [ok i got the count] then count=0
goto counting loop:
end
simply my codes re like that i know i am doing a mistake in somewhere but its ok.I begun picbasic pro 2 weeks before but look where i am? I really don't know any code of assambly i try but it's really hard for me :) i am not at my computer now but when i go my home i will sent the codes may be 1 of u could find the mistake.Thanks for all of u. And 1 note my english could be bad.If i do any mistake when i am writing sorry of that.

mister_e
- 28th May 2005, 17:48
And 1 note my english could be bad.If i do any mistake when i am writing sorry of that.

I really understand what you mean, i'm french so, my english is poor too, but don't worry about that. Nobody's perfect ;)