Input routine and command parser


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Input routine and command parser

    Thanks Charles,

    Would you happen to have a schematic to go with this? Looks like it would make a good article for the projects section.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Input routine and command parser

    Not really. It does run on hardware, of course, but that hardware is really proprietary. But no hardware is needed for this. It will run on your PICDem board.

    This example is actually 3 parts in one.

    Part number 1 (GetCharInput) is a routine that allows you to type and send text to the PIC. It echoes back valid characters, and lets you backspace if you make an error. It "rubs out" the backspace(d) characters, and it terminates when you hit <ENTER> or <ESC>. If you hit <ENTER> it returns the input in an array. If you hit <ESC> it wipes out the array and returns. If you do nothing for 9 seconds, it returns with an empty string.

    Part number 2 (ConvertToUpper) takes the input in mixed-case and converts all the alpha characters to upper case. It leaves numbers and punctuation "as-is". This is handy when you do compares, since people may or may not capitalize the right letters when they type something in.

    Part number 3 (ParseIt) takes the array and searches for any number of strings. When it finds a match, it returns a number that indicates which of the strings matched. This is really useful if you get random data from something like a GPS receiver, or from a network port - or anything.

    I figured that lots of people use things like this (or maybe I'm the only one). At any rate, I use similar routines a lot. They are modified to protect the innocent, and the copyright property of the company I work for.
    Charles Linquist

  3. #3
    Join Date
    Aug 2011
    Location
    Guadalajara, México
    Posts
    28


    Did you find this post helpful? Yes | No

    Default Re: Input routine and command parser

    Thanks for sharing "Master" Charles, this code is very useful indeed, in fact should be great to see this sort of capabilities bundled with PBP.
    I'll try it in the first chance...

    Regards!
    My English doesn't sucks, it's just fugly...

Members who have read this thread : 0

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

Posting Permissions

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