Hserin


Closed Thread
Results 1 to 12 of 12

Thread: Hserin

  1. #1
    Join Date
    Jan 2010
    Posts
    24

    Default Hserin

    When using HSERIN, this code seems to receive the data okay but I can only get numbers to work when using if..then statements. I know I am just overlooking something so any help would be great.

    This works.....
    Code:
    HSERIN [Inc]
    	HSEROUT ["Tx Received", 10]
    	if inc = 1 then goto here
    	if inc = 2 then goto there
    This is what I would like to do.....
    Code:
    HSERIN [Inc]
    	HSEROUT ["Tx Received", 10]
    	if inc = "something" then goto here
    	if inc = "somethingelse" then goto there

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    The code below should work.

    Code:
    HSERIN [Inc]
    	HSEROUT ["Tx Received", 10]
    	if inc = "something" then goto here
            else
           goto there
           endif
    Al.
    All progress began with an idea

  3. #3
    Join Date
    Jan 2010
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    I tired that, it gets bad expression errors on the if inc = "something" line.
    Last edited by GatorGuy; - 23rd February 2010 at 07:49.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I tired that, it gets bad expression errors on the if inc = "something" line
    "something" must be replaced with an ascii character or its decimal equivalent.

    For instance:

    Code:
    HSERIN [Inc]
    	HSEROUT ["Tx Received", 10]
    	if inc = "S" then goto here
            else
            goto there
            endif
    If you Tx the letter "S" then your progam will jump to label "here" and execute the code in it, else it will jump to the label "there" and execute a different code. (if you make it different)

    You have to fix which ascii character you will send to go to label "here" since any other ascii character will take to label "there"

    Al.
    All progress began with an idea

  5. #5
    Join Date
    Jan 2010
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    When I use single letters or numbers it works like a charm but I would like to use longer strings such as "A23". Anything longer then one character and I get errors. Is this a limitation of picbasic?

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    I think the answer simply is in your Manual ... HSerin Modifiers section.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    The following is a technique that I got from Darrel Taylor. It will input a string, and search it for any number of strings.

    Note that the "timeout" in the ArrayRead command is the number of characters in the string you are looking for during that pass.


    Code:
    HSERIN2 300,InputTimeout,[Str CharArray\12\10] ; Take in max 12 chars optionally terminated by LF.
    
    ARRAYREAD CharArray,19,FailedFirst,[WAIT ("FirstStringToLookFor")]
    Goto FoundFirstItem
    
    FailedFirst:
    ARRAYREAD CharArray,21,FailedSecond,[WAIT (SecondStringToLookFor")]
    Goto FoundSecondItem
    
    FailedSecond:
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    I should always learn to read my text before hitting SUBMIT. In the example, I have it inputting only 12 chars, while it is testing for a substring of 19 or 21 chars - but you get the idea.
    Charles Linquist

  9. #9
    Join Date
    Jan 2010
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Thank you! I will give this a try.

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default

    Hi, Gator

    Did your pic decided to start ???

    http://www.electro-tech-online.com/m...-anything.html

    BTW, here is the best place to ask about PBP programs ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  11. #11
    Join Date
    Jan 2010
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Not yet, it turned out to be a programmer error that I wasn't catching. At first it was giving a valid program response then I noticed that it still had an old program on the pic I was using. Building a new programmer today. Its ready to etch now, just waiting 'til morning to finish it.

    And yes, picbasic has been the greatest thing since the pic came out! I can't stand programming with asm.

  12. #12
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi,

    Why have trouble with doubtful programmers ...

    look at the Pickit 2 ( or 3 ) price !!!

    add the universal programmer module ( ~ 30 US$ ? ) and you have one of the bests programming tools available ...

    ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. HSERIN and XOUT command
    By aratti in forum General
    Replies: 20
    Last Post: - 12th May 2009, 11:58
  2. Instant Interrupts and HSERIN
    By Rob in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 31st January 2009, 05:13
  3. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 11:48
  4. 16F877a Interupt driven Hserin
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd November 2006, 00:38
  5. Hserin
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th November 2004, 15:42

Members who have read this thread : 1

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