Author Topic: How to Implement 1-wire Devices  (Read 5552 times)

0 Members and 1 Guest are viewing this topic.

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to Implement 1-wire Devices
« Reply #25 on: July 02, 2018, 06:06:49 pm »

Think of C as if it is a smart assembler. This is what it started as.

A pointer is just an address like you would have used on Z80

Z80 assembly can work with many data types, in C you state type.

In C you also get higher level things you find in basic.



https://www.arduino.cc/reference/en/

http://www.cplusplus.com/
 

Offline DocaraTopic starter

  • Regular Contributor
  • *
  • Posts: 78
  • Country: gb
Re: How to Implement 1-wire Devices
« Reply #26 on: July 03, 2018, 04:52:12 pm »
Hi

After looking through sample code which implements the Search Algorithm I think it is way beyond my programming skills to implement. I can't even get a picture in my mind of how it works - which is, I guess, half the battle to start coding. The techniques that have been used just don't make any sense to me, and I just don't know how to proceed from here.

I have contacted Maxim and submitted a product request for the full S.A. to be implemented in their family of line drivers - the DS2480B being a member. They already do it in their USB to 1-wre chip.

Anyway thank you all for you replies to my question.

Dave mate if you're reading this perhaps a tutorial is in order

Matt

 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to Implement 1-wire Devices
« Reply #27 on: July 03, 2018, 06:21:46 pm »
With your limited program ability, you might want to work on this part first.

If you were to get a Raspberry PI you could work on your software knowledge &
Their is a very simple software interface from the Raspberry PI to One-Wire. The actually communications to/from One-Wire is all written. Your software would be working with files & folders. In addition you could have access to many software languages.


The One-wire has a 64 bit ID

One way is to translate to something you might understand.
Convert this to a directory tree

Think of the ROM_Scan function telling you of existence of two possible folders in a path.

Rom_Scan starts from the LSB and works to MSB
So reading the first 8-bits gives you the family code.

18B20 has family code of 28H which is 0b101000
With only some 18B20's on bus, if you convert  to a windows path you get a path starting with
"0\0\0\1\0\1\0\0"

When Rom_Scan checks first bit you get
0 bit exists = a folder with folder_name = "0" exists
1 bit does not exist = a folder with folder_name = "1" does not exists
when checking the 4'th bit you get 1 exists No 0

After first 8 you start reading the serial number and the CRC.

Now if you had something else with a different family code in addition to 18B20's, one or more of those bit answers would have
0 exists & 1 exists

Any time you get this both exists, you need to remember one path and keep searching other path.

Now if you drop the FLOWCODE

You could just use a ESP32
This will give you a lot of simple options.
You could have a WIFI Web page for 18b20's and more
You could still have serial connection
You could still have CAN

Do a YouTube search of
"esp32 arduino 18b20"

There are a huge number of results.
And some are specific to having many 18B20  temperature sensors

Starting from low end micro-controller can be much harder then starting from HIGH that you can modify to make it match what you want.



 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf