View previous topic :: View next topic |
Author |
Message |
strsh
Joined: 16 Jul 2013 Posts: 37
|
Communication between two PIC with single-wire |
Posted: Wed Apr 23, 2014 1:43 pm |
|
|
Greetings.
Can you write me an example of communication between two PIC (any 8 bit) with a single wire. I looked on the internet, I tried to write code, but I did not succeed. I know there is a solution but I'm not so "strong" in programming and I ask for your help.
Thank you in advance. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Apr 23, 2014 1:57 pm |
|
|
Hi,
Bi-directional communications?
A 'single wire'? A *true* single wire, or a single wire plus Gnd?
John |
|
|
strsh
Joined: 16 Jul 2013 Posts: 37
|
|
Posted: Wed Apr 23, 2014 2:04 pm |
|
|
For starters, one-way communication transmitter-receiver.
I have three wires 1-GND, 2 - VCC, 3 - communication.
I apologize if there are grammatical errors. I write through Google translator, but I hope it is understandable.
Thanks for your prompt response. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Apr 23, 2014 2:53 pm |
|
|
Have a look in the FAQ section of the CCS C manual. They give a good example on how to do it !!!
There are other methods,but for short distances it's a very good place to begin.I'm assuming you only need a meter or so distance ?
I've done true single wire communications for 25+ years,up to 15 miles on a single wire,not fast but ultra reliable.
hth
jay |
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Apr 23, 2014 6:49 pm |
|
|
A couple decades ago Motorola had an 'addressable UART' (MC14469 ?),there's an application note about using it in 'single wire' mode.Should be easy to get a PIC to work very similarly though Black's design is very similar !
The more you read, the better choice you can make.
Best teacher though is a breadboard and time to experiment.
hth
jay |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Thu Apr 24, 2014 9:51 am |
|
|
Why not use 2 wires?
Power w/data signal riding on top and GND?
Also, you could look up Dallas Semi's 1wire protocol for ideas.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Thu Apr 24, 2014 2:56 pm |
|
|
A while back i posted this:
http://www.ccsinfo.com/forum/viewtopic.php?t=51489
Which does a single byte, over a single wire, on any pin.
It relies on Software serial, so it has the same flaws, like not being interrupt friendly.
I was attempting to improve software serial by reducing the waiting time the PICs are stuck on the software serial routines.
I leave it to others to decide if i succeeded or not, or if this is helpful in any way.
EDIT: That "Blacknet" was a nice read!
G. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Thu Apr 24, 2014 8:00 pm |
|
|
hmmm....from the OP, 2nd entry....
"For starters, one-way communication transmitter-receiver. "
We're over complicating things guys....
simple 'putc()' for the xmt..
simple 'getc() for the rcv..
should do fine.
basic 'rs232' type communications
examples are in the FAQ section of manual( I think.been a loooong day)
hth
jay |
|
|
strsh
Joined: 16 Jul 2013 Posts: 37
|
|
Posted: Sat Apr 26, 2014 6:23 am |
|
|
Thanks for your answers.
You helped me with your suggestions to establish one-way communication between the two PIC with RS232 protocol. Thank you.
Greetings. |
|
|
|