One-wire
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: One-wire
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: One-wire
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.
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.
Re: One-wire
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
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
- petesmart
- Valued Contributor
- Posts: 395
- Joined: Thu May 06, 2010 11:42 am
- Location: Sydney, Australia
- Has thanked: 187 times
- Been thanked: 140 times
Re: One-wire
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
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 474 times
sorry about that Chief!
Re: One-wire
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.
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.
- petesmart
- Valued Contributor
- Posts: 395
- Joined: Thu May 06, 2010 11:42 am
- Location: Sydney, Australia
- Has thanked: 187 times
- Been thanked: 140 times
Re: One-wire
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?
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!
Re: One-wire
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.
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 339 times
- Steve
- Matrix Staff
- Posts: 3431
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: One-wire
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.
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.