Array -- something wrong?


Closed Thread
Results 1 to 24 of 24

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

    From the manual... SERIN2 part
    STR followed by a byte array variable, count and optional ending character will receive a string of characters. The string length is determined by the count or when the optional character is encountered in the input.
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I'll try it out.

    Went back to 13 bytes b1 thru b13

    serin porta.0,n1200 [qual1,qual2],b1,b2, -- b13

    which can be done, right?

    even added a long timeout.

    n1200,1000,start [qual1 etc

    but having problems with it too.

    I'm just testing each byte for the right number 1,2,4,8,16 etc

    even tried t1200 and pullups and pulldowns -- 22k and no resistor.

    I'll get it.

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


    Did you find this post helpful? Yes | No

    Default

    Dave, we must agree with Michael, the PBP manual is not realy a masterpiece.

    So I think we should give him some help:


    START:
    SerIn2 PORTA.0,17197,500, START,[WAIT(QUAL1,QUAL2),STR DATAIN\13]


    The above is the line code you must use with serin2 command.

    17197 comes from 813 for 1200 bauds, plus 16384 (bit 14 set because inverted)

    500 are the milliseconds serin2 will wait for data before to timeout to START

    WAIT() will wait for the qualifier sequence before acquiring data

    Str array_name \ 13 is the command to collect 13 bytes in your 13 byte array

    Try it should work.

    Tray to read again,(more carefully) the manual (pag 132-136) very likely you will find it more clear now.

    Al.
    Last edited by aratti; - 26th March 2010 at 17:13.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Dave, we must agree with Michael, the PBP manual is not realy a masterpiece.

    So I think we should give him some help:
    You are correct.
    Sorry Michael.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post

    START:
    SerIn2 PORTA.0,17197,500, START,[WAIT(QUAL1,QUAL2),STR DATAIN\13]


    The above is the line code you must use with serin2 command.

    17197 comes from 813 for 1200 bauds, plus 16384 (bit 14 set because inverted)

    500 are the milliseconds serin2 will wait for data before to timeout to START

    WAIT() will wait for the qualifier sequence before acquiring data

    Str array_name \ 13 is the command to collect 13 bytes in your 13 byte array

    Try it should work.

    Try to read again, (more carefully) the manual (pages 132-136) very likely you will find it more clear now.

    Al.
    Short and sweet, very elegant explanation Al, thanks !
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Great -- I always hate to end up getting code written for me (and I usually don't) but the manual does have problems with being vague.

    More code examples would be nice.

    Oh well, at least this is added to forum "array" search.

    Crystal clear now.

    At first, I just saw SERIN2 as "basic stamp" friendly and ignored it -- after all, I've never even touched a stamp so why should I care?

    Yet the manual sells it that way right up front.

    Thanks kindly.

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


    Did you find this post helpful? Yes | No

    Default

    At first, I just saw SERIN2 as "basic stamp" friendly and ignored it
    SERIN = Basic Stamp 1
    SERIN2 = Basic Stamp 2

    So you should have ignored both.
    Dave
    Always wear safety glasses while programming.

  8. #8


    Did you find this post helpful? Yes | No

    Default

    been ill all week and haven't tried this out yet before I burn a chip, do I also need to add DEFINE SER2_BITS 8 ?

    Or does it default to that?

    Good thing all those mode codes are on melabs site ot that would have been my next question.

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


    Did you find this post helpful? Yes | No

    Default

    Default is
    8 N 1
    Dave
    Always wear safety glasses while programming.

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