Shop OBEX P1 Docs P2 Docs Learn Events
Detecting Sub-strings in ASCII Text — Parallax Forums

Detecting Sub-strings in ASCII Text

FrankFrank Posts: 3
edited 2004-12-21 17:35 in BASIC Stamp
Hi. Just got the stamp yesterday. The project I am working on is reading an ascii string and if certain sub-strings are found certain actions will occur. Its been 20 years since I worked with basic so I am rather rusty. The actual project is to read the codes of an EAS (weather alert) and decide if functions other than the ones the endec supports will occur. Any help ? Thanks 73 Frank

Post Edited By Moderator (Jon Williams) : 12/21/2004 3:58:39 PM GMT

Comments

  • RickBRickB Posts: 395
    edited 2004-12-21 15:12
    The Serin instruction with the proper parameters is very effective at doing exactly what you want. The manual explains it all.

    Rick
  • FrankFrank Posts: 3
    edited 2004-12-21 15:31
    Maybe I am dense but I cannot seem to see how to start. I have looked at the SERIN thinking this is what I want but do not know how to set the parameters. The data will come in as 8 bit no parity true. This gives a baudmode of 813. but where do I put this info? TNX 73 Frank
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-21 15:43
    Hi Frank,

    Just a quick critique....be sure, when you post, that you use a proper subject header.· Lots of people use the forums and are picky about what they view.· "Hello" doesn't lead them to be curious enough to see what it's about....I'm more nosey than curious! haha



    Anyhow, in the manual there are some examples of the SERIN command.

    Here's a quick usage:

    SERIN commin, n19k2, [noparse][[/noparse]data]

    Now, you have to set up your constants and variables at the beggining of you program.
    commin PIN 0
    n19k2 con 110
    data var word

    So you have the SERIN command followed by the pin you want the data to come in on, then you need to tell it how fast to expect it, and finally, where to put it.
    This is the simplest way to use SERIN....there are other flow pins and timeout functions...but this is what you need for babysteps!

    So, if I were to rewrite my program without the constants, it would be:
    SERIN 0, 110, [noparse][[/noparse]data]

    you still have to have a variable declared in order to store your incoming data.·

    Read the help file in PBasic and you can make leaps and bounds...as well as all the educational material on the Parallax website (What's a Microcontroller" comes to mind.)



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • FrankFrank Posts: 3
    edited 2004-12-21 16:10
    Thanks, Steve. My old brain is having trouble getting this sorted out. Will try this and let you know. 73 Frank
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-21 17:35
    Hi Frank,

    just a quick note....

    the code I threw on there was using a BS2P...so a BS2 would require different baud numbers....



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Sign In or Register to comment.