One-wire

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
danilof
Posts: 24
Joined: Wed Feb 24, 2016 9:01 pm
Contact:

One-wire

Post by danilof »

I am looking to work with the DS1990a device but looking the 1-wire device present on the flow-code I see that there is a component developed for DS 1820. Is there a one-wire component to work with DS1990?

User avatar
Benj
Matrix Staff
Posts: 15045
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: One-wire

Post by Benj »

Hello,

The 1-wire component should work as is with the DS1990. There are macros specifically for the DS1820 but the other macros are more generic and should work with any 1-wire device.

Let us know how you get on.

burak
Posts: 5
Joined: Thu Jul 12, 2018 11:25 am
Contact:

Re: One-wire

Post by burak »

Hello Benj,

My question related this topic . I want to use one wire communication . But I cannot find basic and useful example or information about one wire communication . Besides if you know how to communicate using- one wire communication - 30F614A to other device(for example :fuel gauge) please, can you give me some sources including simulation,example code (3D: System Panel), explanations etc...?

How do we use 30F6014A for one wire communication ?
Manythanks.

User avatar
Steve
Matrix Staff
Posts: 3232
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: One-wire

Post by Steve »


Docara
Posts: 312
Joined: Sun Jun 23, 2013 1:29 pm
Contact:

Re: One-wire

Post by Docara »

Hi Burak,

Not meaning to hijack your post but I have requested a component from Matrix that if implemented correctly should allow for transparent communication with Flowcode and 1-wire Devices. At the moment they are still thinking things though!

I have also come across the limitations of FC and 1wire devices and realised that a specific component for each 1wire device available within FC is NOT required or realistic. All that IS required is for FC to deal with the bi-directional low level stuff needed to 'talk' to theses devices - a Search Algorithm, 1wire handshaking, CRC and data. Then presenting us this information as a sequence of 8bytes for us to use as we see fit, and vice versa of course.

http://www.matrixtsl.com/mmforums/viewtopic.php?t=19850

I have included a line driver in my suggestion that virtually eliminates all timing problems with the bus that would normally need to be sorted out in software and increases that bus lines to over 200m.

If you like my suggestion why not let Matrix know it's worth pursuing

Matt

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Contact:

Re: One-wire

Post by petesmart »

Hi Burak,

here is an example of a 1-wire temp monitor program.

Step 1 change the target to your device

Step 2 - run the program on your devce h/w and monitor the 1-wire traffic with a CRO or data analyser

Step 3 fiddle with the timings to get the pulse widths correct. You can adjust to suit your specific target device

I have used this program quite often - it works reliably

best

Pete
Attachments
temp monitor.fcfx
(13.17 KiB) Downloaded 148 times
sorry about that Chief!

burak
Posts: 5
Joined: Thu Jul 12, 2018 11:25 am
Contact:

Re: One-wire

Post by burak »

Thank you for precious help Steve, Docora and Petesmart . These information will be really useful.

I have a question for Petesmart's code. I observed the his code. He can manually adjust set ,reset and wait for bus to go high processing . But according to matrix reference guide for one wire communication page (following )

https://www.matrixtsl.com/wiki/index.ph ... 82b7c71023

if I don't misunderstand , These are implemented(set, reset , presence pulse ,presence of slave device ) via BusReset and ScanBus , do not it ?

Manythanks.

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Contact:

Re: One-wire

Post by petesmart »

ScanBus and Busreset are functions used to read the devices on the bus.

My program is much more simplistic in terms of function, however it does allow you to trim the timings of the pulses..I found that some devices had a norrow pulse timing tolerance therefore I had to adjust the timings.

Make sense?
sorry about that Chief!

burak
Posts: 5
Joined: Thu Jul 12, 2018 11:25 am
Contact:

Re: One-wire

Post by burak »

Hi everyone ,

First question :I tried the Ds18S20 temperature sensor using standart powering the DS18S20 with an external power supply .(no parasitic power) pull up res:4.7k

According to my code(namde as DS1820) , Start conversion and Read Scratchpad command (Crc is not active ) are passed successfully without any problems.
I encountered a problem while reading the temperature.
After DS1820_GetTemp() command the code enters right way and green and blue leds are on .
The actual room temperature =23-25 degree but according to code the temperature is lower than zero ? Why?
I think , Because of the sign representation ? Temperature values is represented as 2’s complement form ???

Actually I want to see that , if the room temperature is lower than 30 degree , the blue and red leds will be on. And when the temperature rises above 30 degree , the blue and green leds will be on without using any LCD .
As I mentioned above , I read the temperature minus value(lower than zero ) , how can I fix this problem ? Do I make a mistake in one step ? or Could ds1820 be measuring wrong ?

Second question : The second thing I dont understand , In singleOne wire example code which matrix give to users , Calculation of integer and real parts of the temperature , exactly I did not understand
Temp2=(Temp MOD 2)*5
Temp=Temp/2
Manythanks.
Attachments
OneWireExample.png
example png (second questions)
(42.42 KiB) Downloaded 2885 times
DS1820.fcfx
my code (first question)
(22.4 KiB) Downloaded 83 times

User avatar
Steve
Matrix Staff
Posts: 3232
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: One-wire

Post by Steve »

I can try to answer the second question. That temperature sensor reading is returned in a byte. The top 7 bits of the byte are the whole-number of the temperature. Bit zero is 0 for x.0 and 1 for x.5.

So to get the fractional part of the temperature, the first bit is masked-off (using MOD 2, although it could also be done with AND 1) and then multiplied by 5 to give either "0" or "5".

The whole number part is divided by 2 which essentially removes bit zero and shifts the number.

The number format is explained here:
https://datasheets.maximintegrated.com/ ... S18S20.pdf

For your first question, I did notice the "DS18B20" has a different number format for the temperature. So if you are using the "B" version and not the "S" version then the number read back will be very different.

I hope that helps,
Steve.

Post Reply