Announcement

Collapse
No announcement yet.

Pic basic string storage

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pic basic string storage

    Ok imagine this set of non standard basic statements..........


    dim a$ as char(50)

    for x=1 to 50

    mid$(a$,x,1)=serin(port something)

    next x

    I end up with at least 50 chars from the serial port in a$


    Now that I have them, I can parse them.

    Imagine I am looking for keywords in that string.....

    (say 'feed the' 'dog' 'cat' 'bones' 'meat' 'water' 'milk')

    So I parse for valid instructions, otherwise I would forget and starve them...

    So an incoming data stream of

    ''ghdfkghkdFEED THElkjgdjfCATjdflgjMILKjsdfjfjsdljfl"

    would mean to milk the cat, sorry give milk to the cat...

    But...........

    ''ghdfkghkdFEED THElkjgdjfMILKjdflgjCATjsdfjfjsdljfl"

    would be the same, 'feed the milk cat' while out of context is valid

    'Feed the' is just a qualifier and once I have that I can look at the rest of the burst of data I'm getting........

    I have used

    SERIN portb.7,t1200,1000,comserr3,["FEED THE"]

    and it works a treat but........

    I cant follow it with

    SERIN portb.7,t1200,1000,comserr3,["CAT"]

    because it may be time to feed the dog....

    If I time out waiting for the cat, the dog may run past....




    Pic control was so much easier when I could just wire a switch to a pin!
    Edit/Delete Message
    Lez, more widely known as flez1966
Working...
X