CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Uart + 1-wire same cable

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Uart + 1-wire same cable
PostPosted: Mon Sep 09, 2019 6:52 pm     Reply with quote

Hi, has anyone had any success sharing 1-wire data with a UART?
I have some remote mounted ds18b20 sensors and the customer requested a screen AT the sensor location.

Wiring this setup again is something i REALLY want to avoid... ive spent over 16 hours laying cable just for the sensors...its only about 40 feet, but a terribly complicated path.

The data line has a strong pullup driven by a FET at the master... as per AN-148. Its a simple setup but it works great.

3.3V, GND and 1-wire data line is all i got.
AWG22

Any ideas?
_________________
CCS PCM 5.078 & CCS PCH 5.093
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 09, 2019 6:59 pm     Reply with quote

See this CCS FAQ article:
"What is an easy way for two or more PIC MCUs to communicate?"
http://www.ccsinfo.com/faq.php?page=connect_pics
You have the two files it mentions. They are in your
CCS examples folder.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Sep 09, 2019 7:23 pm     Reply with quote

I meant 1 wire as in "Maxim/Dallas 1-wire" and using that same wire for regular serial.
_________________
CCS PCM 5.078 & CCS PCH 5.093
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Mon Sep 09, 2019 7:55 pm     Reply with quote

You'd have to experiment. The only 1 wire device I've used is a DS1820 (or 18B20?) temperature sensor. From memory, you have to start the transaction by first asserting the 1-wire line low for a relatively long time. If you rig things so that your serial communication's baud rate is set so that the line is never low long enough to trigger the 1-wire device, you may be able to pull it off. However you'd need to make sure that whatever you choose operates under power supply extremes and anticipated temperature extremes.

Edit: I suppose you could also go to the other extreme. If you slow the baud rate down so much that the 1-wire's "answers" look like jitter, then you should be able to communicate by asserting the line low (as is appropriate given what you want to transmit), hold it low for your bit time, then release the line (high-Z), and let the temperature sensor think it's doing something useful while it holds the line low for a few microseconds before releasing it. You'd need to enable the pullup on that pin, if the PIC has pullups. If not, add an external pullup and ensure you enable the open drain on that pin (which would also be required).


Last edited by newguy on Mon Sep 09, 2019 8:02 pm; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 09, 2019 8:02 pm     Reply with quote

Rethink the overall hardware !
Since you're going to have 'screen' as well as the temp sensor, add a PIC at the remote location..then single wire comm is easy.
What 'screen' will you use ? I'm wondering if the DS data will affect the screen?

Adding a $1 PIC still seems the right way to go though. Especially when the client says 'now I need 2 pushbuttons and a buzzer and ........'


Last edited by temtronic on Tue Sep 10, 2019 5:05 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 09, 2019 9:20 pm     Reply with quote

Gabriel wrote:
I meant 1 wire as in "Maxim/Dallas 1-wire" and using that same wire for regular serial.

The upper schematic in the FAQ article shows one wire.
PrinceNai



Joined: 31 Oct 2016
Posts: 480
Location: Montenegro

View user's profile Send private message

PostPosted: Wed Sep 11, 2019 4:50 am     Reply with quote

I'd also go Mr. Temtronic's way. Add another PIC at sensor location and use those three wires just for UART communication.
smee



Joined: 16 Jan 2014
Posts: 24

View user's profile Send private message

PostPosted: Wed Sep 11, 2019 4:56 am     Reply with quote

You could make use of a ds2404s and make a remote screen, and then use the Dallas one wire bus to display on the screen.
Thats if they still make it. Maxim killed off many parts.
Otherwise as long as you don't pull the bus low for more than 480uS you can use serial like you wanted to.

Or issue a reset, and a match rom and then 8 zeros, to deselect all devices on the bus, then it's yours to do as you wish, provided you don't issue a reset pulse ( >480us ).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group