Shop OBEX P1 Docs P2 Docs Learn Events
SEROUT and Array Index — Parallax Forums

SEROUT and Array Index

YendorYendor Posts: 288
edited 2006-09-29 10:09 in General Discussion
Hi Bean, it's·your favorite pest again!

I'm using an array with SEROUT, and wanted to ask you another question about the data parameter.

The following code is an example to illustrate the issue.· It·compiles w/ no errors.

Data(k) works correctly, but Data(i-1) does not.
FOR i = 1 TO numBytes 

   k=i-1 

   SEROUT OutPin, Baud, Data(i-1) 

   SEROUT OutPin, Baud, Data(k) 
NEXT


Should we be able to calculate the index in the SEROUT data parm?

This is not a big deal, and is easily fixed using another variable, but·thought since you're working on a list...·

Also, looking at the·assembly differences made me feel kinda sleepy...

Thanks!

Rodney

Comments

  • BeanBean Posts: 8,129
    edited 2006-09-29 10:09
    Rodney,
    You've become the #1 debugger.
    No, you cannot do a calculated index.
    The "SEROUT OutPin, Baud, Data(i-1) should give an error.
    I will put that on the "to-do" list too.

    PLEASE don't think that you are pestering me. I love when people find bugs, it makes the compiler better for everyone. And it keeps me grounded.

    Plus I want to enhance the SERIN command anyway. So this will give me an excuse to do that. I want to allow you to specify a timeout WITHOUT a label and the program will just continue when the timeout occurs (with the destination variable unaffected).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    There are only two guaranteed ways to become weathy.
    Spend less than you make.
    Make more than you spend.


    Post Edited (Bean (Hitt Consulting)) : 9/29/2006 11:55:53 AM GMT
Sign In or Register to comment.