Shop OBEX P1 Docs P2 Docs Learn Events
I've broken my code - running out of hair - please spot the obvious mistake — Parallax Forums

I've broken my code - running out of hair - please spot the obvious mistake

pacmanpacman Posts: 327
edited 2013-04-06 22:09 in Propeller 1
I managed to break my code (it's a skill I have).

Basically I'm reading a string of serial data and doing stuff with it...

Towards the end of MAIN I call a debugging routine called PrintBuffer, then I call the CheckMessage routine. The very first step of CheckMessage is to call PrintBuffer again as somewhere beteen the printBuffer calls it gets screwey.

so in Psudeo code

Main
...
PrintBuffer(@InBuffer)
CheckMessage (@InBuffer)



CheckMessage (message)
PrintBuffer (@message)



How can the two strings from PrintBuffer be different?

Capture.JPG
Modbus_PAC.spin


Huge thanks in advance
724 x 632 - 32K

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-04-06 17:51
    pacman wrote: »
    Main
    ...
    PrintBuffer(@InBuffer)
    CheckMessage (@InBuffer)



    CheckMessage (message)
    PrintBuffer (@message)
    message is an address so there is no point in dereferencing it again. IOW get rid of the @.
  • pacmanpacman Posts: 327
    edited 2013-04-06 21:58
    THANKS Kuroneko.

    Seems just when I _think_ i've got a handle on string data - I make a mistake like this...
  • kuronekokuroneko Posts: 3,623
    edited 2013-04-06 22:09
    FWIW, if you ever use byte MBStack[100] (currently unused) for cognew please make it a long array first.
Sign In or Register to comment.