Shop OBEX P1 Docs P2 Docs Learn Events
Lost on what should be simple. — Parallax Forums

Lost on what should be simple.

Eric REric R Posts: 225
edited 2011-05-18 19:21 in Propeller 1
This is intended to read serial data from a cog (Scanner1), determine if two chatracters are equal or not equal and return the value to the parent. I am missing something here. This has been a scratch pad of tests so it has no real documentation. The end result, the child object will launch 3 times and the LCD will go away. Simply at a loss on this one after days of playing with it.

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2011-05-17 15:53
    Your code doesn't call the method "Scanner", which is used to start up a serial port. This means the serial port is never started. The method "Thirty" calls itself recursively, which will very quickly overflow it's stack of 10 longs. You should use a repeat at the beginning of Thirty to make it loop. The method "scanner" has a call to Thirty. This call should be removed.

    The Results method used lcd.str to print the value of dat1. You should use lcd.dec instead.
  • Eric REric R Posts: 225
    edited 2011-05-17 16:18
    Thanks,

    I think I have made all of the corrections mentioned. I am still not seeing the return value of 1 or 2. Any ideas?
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-17 21:11
    Eric R wrote: »
    ... I am still not seeing the return value of 1 or 2. Any ideas?
    Can you confirm that you actually get past the TM30 := Scan1.rx? Maybe the rxflush consumes the first few characters? If not just insert a long[Data1Addy1] := POSX along the way to see how far you actually get.

    Also, it may be advisable to increase the stack size slightly (32 longs). 10 looks a bit tight given that you call another object from your method. Other than that there is nothing wrong with the code, I fed 30 '?' characters into the method and it reports 1 as expected.
  • Eric REric R Posts: 225
    edited 2011-05-18 19:21
    Thanks, both of you were a great help. While some of the mistakes were due to testing like the LCD.str was pointing to a "good" or "bad" statement and the "scanner" method was moved due to the overflow which was not the cause. Bottom line was the stack size was too small. Thanks for pointing that out. I now understand passing parameters much better than I did a couple days ago!
Sign In or Register to comment.