Help with Maxim Ibutton "IF THEN ELSE" statements please


Closed Thread
Results 1 to 39 of 39
  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237

    Unhappy Help with Maxim Ibutton "IF THEN ELSE" statements please

    Hi thanks for reading this...

    Am attempting to sort out some Ibutton DS1990 security code.... I have this:-

    OWOUT iButton,1,[$33]
    PAUSE 100
    OWIN iButton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]

    IF Serial[1]=$15 AND Serial[2]=$D3 AND Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00THEN correct1
    IF Serial[1]=$68 AND Serial[2]=$36 AND Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00THEN correct2
    IF Serial[1]=$1E AND Serial[2]=$1A AND Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00THEN correct3
    'else gosub wrong
    'endif
    GOTO mainloop

    This works fine for the correct1,correct2, and correct3 labels.....

    What I am attempting to do is; If the code doesn't see one of the three detailed Ibuttons it runs error label "wrong"


    I know it must be easy (should be) but not seeing it !

    My Picbasic 2.50C

    Help welcome.......Please. !!!

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by andybarrett1 View Post
    Hi thanks for reading this...

    Am attempting to sort out some Ibutton DS1990 security code.... I have this:-

    OWOUT iButton,1,[$33]
    PAUSE 100
    OWIN iButton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]

    IF Serial[1]=$15 AND Serial[2]=$D3 AND Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00THEN correct1
    IF Serial[1]=$68 AND Serial[2]=$36 AND Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00THEN correct2
    IF Serial[1]=$1E AND Serial[2]=$1A AND Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00THEN correct3
    'else gosub wrong
    'endif
    GOTO mainloop

    This works fine for the correct1,correct2, and correct3 labels.....

    What I am attempting to do is; If the code doesn't see one of the three detailed Ibuttons it runs error label "wrong"


    I know it must be easy (should be) but not seeing it !

    My Picbasic 2.50C

    Help welcome.......Please. !!!
    Your if correct then labels construction can not be in one line format.

    so for example

    IF Serial[1]=$15 AND Serial[2]=$D3 AND Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00THEN
    correct1
    else
    gosub wrong
    endif

    Obviously you need to allow for the three "correct" options.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Hi,
    Since your IF-THEN statements are actually GOTOs (if evaluated true) all you need to do is add GOSUB (or GOTO) WRONG after the three IF statements.
    Code:
    IF Serial[1]=$15 AND Serial[2]=$D3 AND Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00 THEN correct1    '<----This will GOTO correct1
    IF Serial[1]=$68 AND Serial[2]=$36 AND Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 THEN correct2
    IF Serial[1]=$1E AND Serial[2]=$1A AND Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 THEN correct3
    GOSUB WRONG
    GOTO mainloop
    Now the WRONG subroutine will only execute if none of the three IF statements evalutate true.

    /Henrik.

  4. #4
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Henrik

    You mean :-

    Now the WRONG subroutine will only execute if none of the three IF statements evalutate FALSE.

    Not near the units so cant try at moment !

    Thank you for reading

  5. #5
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Henrik,

    That is neat! Although I do not like using goto statements as they can make the program logic difficult to follow.

  6. #6
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by andybarrett1 View Post
    Henrik

    You mean :-

    Now the WRONG subroutine will only execute if none of the three IF statements evalutate FALSE.

    Not near the units so cant try at moment !

    Thank you for reading
    No he means:-

    Now the WRONG subroutine will only execute if ALL of the three IF statements evalutate FALSE.
    Last edited by EarlyBird2; - 8th May 2014 at 10:31.

  7. #7
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by EarlyBird2 View Post
    No he means:-

    Now the WRONG subroutine will only execute if ALL of the three IF statements evalutate FALSE.
    So its like a :-

    IF NOT THEN

    Sorry for being so dim.....Thank you for help !

  8. #8
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Not what was meant.

    All you need to do is change this

    else gosub wrong
    endif

    to this

    gosub wrong

    in your code

  9. #9
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    All good....

    Will try later and advise

    Thank you for help.....

    In Sunny Scunthorpe on Monday/Tuesday

    Wonderful BOS Plant at Tata !!!

  10. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Hi,
    Now the WRONG subroutine will only execute if none of the three IF statements evalutate FALSE
    No, as have been said. If the first condition evalutes TRUE the execution will GOTO correct1 and therefor bypass the GOSUB WRONG statement. Same thing if the second or third condition evalutes TRUE. However, if none of the three conditions evalutes true the GOSUB WRONG will execute. Remember that the way you have your IF statment written it'll issue a GOTO, not GOSUB so make sure that your correct1, 2, 3 routines does not end with a RETURN.

    That is neat! Although I do not like using goto statements as they can make the program logic difficult to follow.
    I totally agree, GOTOs can lead to some real mess but sometimes it's the easy way.....and there's almost always more than one way to do what one wants.

    /Henrik.

  11. #11
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    In Scunthorpe to see the BOS plant?

    I am amazed but thinking about it I can not think of any other reason to come here.

    Hope you did not travel far!

  12. #12
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Laughs...

    Yes BOS Plant ..... Told if Really lucky might get to see your 4 Queens of steel making too....

    Before dining in style at Deans on Brigg road !

    Thanks for help again all

  13. #13
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    You saw the four queens!

    I bet that made your day.

    I assume Deans is a burger van.

    You are welcome.

  14. #14
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Will play about with it later...

    Am understanding more now

    Thank you

  15. #15
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Steve, I beg to differ about your statement:"Your if correct then labels construction can not be in one line format." Oh really, and what makes you say that? If the statement is TRUE the operation is passed to the address of Correct#. Although it is not the way I would write the compound statement it is 100% acceptable.
    Dave Purola,
    N8NTA
    EN82fn

  16. #16
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Code
    mainloop: Owout ibutton,1,[$33]
    pause 100
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]

    If Serial[1]=$15 and Serial[2]=$D3 and Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00 then correct1
    If Serial[1]=$68 and Serial[2]=$36 and Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct2
    If Serial[1]=$1E and Serial[2]=$1A and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct3
    If Serial[1]=$F0 and Serial[2]=$66 and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then nocache
    gosub wrong
    Goto mainloop
    Hi all...

    Tried the above and variants of it....It is now just going staight to the gosub routine (wrong) I suspect because with no Ibutton in place the "Serial Number" is after all wrong!!

    Help........!!!!
    Last edited by andybarrett1; - 8th May 2014 at 21:24. Reason: Typo

  17. #17
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by Dave View Post
    Steve, I beg to differ about your statement:"Your if correct then labels construction can not be in one line format." Oh really, and what makes you say that? If the statement is TRUE the operation is passed to the address of Correct#. Although it is not the way I would write the compound statement it is 100% acceptable.
    Dave you are correct as Henrik's post has already demonstrated. We both agree that we would not write the compound statement this way. My biggest objection is the use of the 'goto' statement which although perfectly valid is an instruction I was taught not to use a long time ago. I read the "Correct#" as a gosub instruction not a goto statement which was my mistake.

  18. #18
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    It is typically necessary to use parenthesis between logical comparisons as:

    If (Serial[1]=$15) and (Serial[2]=$D3) and (Serial[3]=$7D) AND (Serial[4]=$16) AND (Serial[5]=$00) AND (Serial[6]=$00) then correct1

    I believe that it forces a Boolean comparison rather than a mathematical evaluation.

    One last - is it necessary to compare ALL bytes, or might you only compare say... the first one. This would seem to yield a unique condition and save the effort and complexity of so long a line:

    If (Serial[1]=$15) then Correct1

  19. #19
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by Amoque View Post
    ...

    One last - is it necessary to compare ALL bytes, or might you only compare say... the first one. This would seem to yield a unique condition and save the effort and complexity of so long a line:

    If (Serial[1]=$15) then Correct1

    Speaking out my bellybutton, I'd say yes. The other serial numbers still have to be validated (knowing absolutely nothing about his application).

    Robert

  20. #20
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    There is some good code here

    http://www.picbasic.co.uk/forum/cont...r-nine-of-them

    I particularly noted there is no pause between the owout and owin.

  21. #21
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Hi,
    Tried the above and variants of it....It is now just going staight to the gosub routine (wrong) I suspect because with no Ibutton in place the "Serial Number" is after all wrong!!
    Well, if what you're saying is that you don't actually have an IButton connected then I think you've found the problem. Of course the numbers will be wrong, none of the IF statements will evaluate TRUE so the exection will fall thru to the GOSUB wrong statement.
    Help........!!!!
    This may sound like a totally crazy idea but you might try connecting an IButton and see if that possibly helps.

    :-)

    /Henrik.

  22. #22
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Hi Henrick

    Yes works fine with button....But!

    A lot of the time it needs to sit waiting for a button (looping till it sees one... then it jumps to sub routine if right button) "If" wrong button applied I need to jump out and go elsewhere !

    So yes a lot of waiting with no button.

  23. #23
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Thank you Steve

    Will read though later .... See it reveals any clues !!

    BR
    Andy

  24. #24
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by Demon View Post
    Speaking out my bellybutton, I'd say yes. The other serial numbers still have to be validated (knowing absolutely nothing about his application).

    Robert
    Yes they do ALL need verifying...

    BR
    Andy

  25. #25
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Andy,

    I get it now!

    You are validating ibuttons that are not always present. In fact most of the time there will not be an ibutton to read.

    You are saying you need to detect the presence of an ibutton and when detected check it's serial number and if correct take some action (open a lock for example) if incorrect take some other action (sound an alarm for example)

    Is this true?

  26. #26
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    That is the Badger!

    Yes.

  27. #27
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Your program needs a loop that checks for the presence of an ibutton and if not present continue looping other wise jump out the loop into a serial number read/verify routine eventualy going back to the loop.

    Any ideas of how to test for an ibutton present?

  28. #28
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Steve

    Could this be the Presence Pulse.. It mentions this in the Datasheet but no command. I Know the 1990R has it the 1990A has not .... I am using a "R"

    Read Rom [33h] or [0Fh]
    Search [F0h]
    Match [55h]
    Skip [CCh]

    Presence [??h]

    Searching around on a phone internet at moment so limited on resources!

    BR
    Andy

  29. #29
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Could you use the value in S0 as a check. What value does it have with no button and what value with a button? There is also S7 CRC value that could be used in the same way.

    You may need to reset S0 on each loop say to $0 then run owout owin and test the new value.

    Just ideas nothing is tested

  30. #30
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Update:-

    Just found this thread from a whilst back....

    http://www.picbasic.co.uk/forum/showthread.php?t=9375

    Seems am not the only one with these issues !

  31. #31
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Brilliant there is you answer thanks to Darrel.

    Start:
    OWOUT IBUTTON, 1, [$33], start ; Detect if OW device is present
    .
    .
    .

  32. #32
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    mainloop:
    Start:
    OWOUT IBUTTON, 1, [$33], start ; Detect if OW device is present
    Owout ibutton,1,[$33]
    pause 100
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]
    Edited this from phone so might be dodgy..... Maybe the solution ?

  33. #33
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Code

    mainloop:
    High led
    pause 250
    low led
    pause 250

    Owout ibutton,1,[$33],mainloop
    pause 100
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]
    'If Serial[1]=$15 and Serial[2]=$D3 and Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00 then correct1
    'If Serial[1]=$68 and Serial[2]=$36 and Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct2
    'If Serial[1]=$1E and Serial[2]=$1A and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct3
    'If Serial[1]=$F0 and Serial[2]=$66 and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then nocache
    If Serial[7]=$E6 then correct1
    If Serial[7]=$90 then nocorrect
    gosub wrong
    Goto mainloop
    We seem to be getting there.... My issue now has changed, I suspect a timing issue.

    It loves the "wrong" gosub...if I hold the button on the contacts all good but the slightest slip and I am in the wrong gosub!

    I have tried just minimising the code to the CRC of the serial and using that but the same results... putting delays in not helping...

    I am hoping it is not the debounce on the contacts.... though we could fix that ??

    Any Ideas anyone

    Thank you ...Andy

  34. #34
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Change this

    Owout ibutton,1,[$33],mainloop
    pause 100
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]

    to this

    Owout ibutton,1,[$33]
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]],mainloop

    or this

    Owout ibutton,1,[$33],mainloop
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]],mainloop

  35. #35
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    I am curious as to how many ibuttons and "doors" you expect to have in your system.

    I have developed an entry system in the past which had many entry points and swipe cards. Hard coding the serial numbers into the program is not the way to go, for all but the smallest systems.

  36. #36
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Thumbs up Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Quote Originally Posted by EarlyBird2 View Post
    I am curious as to how many ibuttons and "doors" you expect to have in your system.

    I have developed an entry system in the past which had many entry points and swipe cards. Hard coding the serial numbers into the program is not the way to go, for all but the smallest systems.
    Only three Buttons (One Door or in this case Gate)

    The data sheet suggests the pause 100… So that good.
    Have already tried the mainloop label on the Owin as well as the Owout !! (I did read the manual…again!)

    Also seems to be no difference in operation between DS1990R device and DS1990A Device…. The "R" has the Presence…. But Datasheets are sparse !!!

    I am still pondering over timing issues…..I know hardcoding serial numbers is not ideal but it is only small ,,
    Having said that I just made the change from 1k to 2k memory..627 to 628 !

    Also wondering "IF" I can shorten the VAR ARRAYS any!

    Learning a lot here ….. Thank you!

  37. #37
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    You could set up a retry loop.

    mainloop:
    High led
    pause 250
    low led
    pause 250

    for I=1 to 5 'or anything you like
    Owout ibutton,1,[$33],mainloop
    pause 100
    owin ibutton,0,[Serial[0],Serial[1],Serial[2],Serial[3],Serial[4],Serial[5],Serial[6],Serial[7]]
    If Serial[1]=$15 and Serial[2]=$D3 and Serial[3]=$7D AND Serial[4]=$16 AND Serial[5]=$00 AND Serial[6]=$00 then correct1
    If Serial[1]=$68 and Serial[2]=$36 and Serial[3]=$4F AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct2
    If Serial[1]=$1E and Serial[2]=$1A and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then correct3
    Next i
    'If Serial[1]=$F0 and Serial[2]=$66 and Serial[3]=$2C AND Serial[4]=$17 AND Serial[5]=$00 AND Serial[6]=$00 then nocache
    gosub wrong
    Goto mainloop

    change the value of I to test for optimum performance.

  38. #38
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Steve

    The retry loop seems to have cured the missreading.... If it dont get it the first time it tries 3 more times... I=3
    I have also put :- If (Serial[1]=$F0) etc in brackets... Tides things up a bit.:-)

    It seems to be working OK now

    Thank you again for help....Maybe see you in Scunny on Monday ...!!!

    THank you all others who helped..... Great Forum!!

  39. #39
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Help with Maxim Ibutton "IF THEN ELSE" statements please

    Andy

    You are welcome. If you need any more help just ask.

    Cheers

Similar Threads

  1. Replies: 0
    Last Post: - 14th November 2013, 04:32
  2. Replies: 3
    Last Post: - 15th October 2012, 09:06
  3. Replies: 8
    Last Post: - 3rd March 2011, 23:20
  4. Replies: 5
    Last Post: - 28th February 2011, 16:33
  5. Replies: 1
    Last Post: - 16th February 2005, 21:05

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts