### One wire search algorithm

Posted:

**Wed Nov 25, 2020 10:22 am**Hello to all !!!

I have been trying for a week to implement a search rom command... As you might imagine i am a little bit frustrated since i haven't managed yet to make it work completely ... I have understood most of it, with an exception of when the

bit_counter < last_discrepancy ....Take the same path as last time (from last ROM number found) . How does this part works? I am asking because i tried it on a paper, and when there is 3 dicrepancies in a row i cant understand how this will work...

Any explanation would be grateful!!!

Thank you all Panagiotis

An example:

0001 0111 0000 this should be the first discovery on the search

0101 0100 1001 this should be the forth

1001 0011 0110 this should be the third

1111 0101 1010 this should be the second

ps. After the second search my code doesnt work as expected, and thats because i havent understood this part..

I have been trying for a week to implement a search rom command... As you might imagine i am a little bit frustrated since i haven't managed yet to make it work completely ... I have understood most of it, with an exception of when the

bit_counter < last_discrepancy ....Take the same path as last time (from last ROM number found) . How does this part works? I am asking because i tried it on a paper, and when there is 3 dicrepancies in a row i cant understand how this will work...

Any explanation would be grateful!!!

Thank you all Panagiotis

An example:

0001 0111 0000 this should be the first discovery on the search

0101 0100 1001 this should be the forth

1001 0011 0110 this should be the third

1111 0101 1010 this should be the second

ps. After the second search my code doesnt work as expected, and thats because i havent understood this part..