Shop OBEX P1 Docs P2 Docs Learn Events
Can anyone explain or duplicate this error — Parallax Forums

Can anyone explain or duplicate this error

bambinobambino Posts: 789
edited 2006-12-11 14:04 in Propeller 1
·[noparse][[/noparse]code "test debug"
obj
·· com : "SimpleDebug"
·· pad : "Keyboard"
Var
·· long stack[noparse][[/noparse]9]
·· byte thing
·· byte cog
pub Main
·· cog := (cognew(com.start(115200),@stack)+1)
·· pad.start(27,26)
·· repeat
···· thing := new.key
···· com.putc(thing)
···· waitcnt(25_000+cnt)
···outa[noparse][[/noparse]16]
/code]
This code (done from memory,may not be exactly what I got at home) works,
but when I take out the line outa[noparse][[/noparse]16] I get nothing when I run the program.
This isn't how I intend to use the routine, I actually have it working without the outa in a subroutine instead of main. I am just curious why the loop will not execute without the outa statement doing nothing here, when it seems like it would never get called anyway.

Comments

  • Graham StablerGraham Stabler Posts: 2,507
    edited 2006-12-07 15:09
    need to see the actual code I think
  • bambinobambino Posts: 789
    edited 2006-12-07 15:56
    I will try to bring it in tomarrow!!
  • bambinobambino Posts: 789
    edited 2006-12-08 13:22
    Here is what I was using to get the error.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2006-12-09 00:21
    unfortunately I don't have any serial set up to test properly.

    As you rightly say it should never run the outa line. I wonder if the problem is the waitcnt, this is the only command that could go wrong if the time was too short. I wonder if increasing the delay would change anything. Grasping at straws, most confusing.

    Graham
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-12-09 00:45
    Spawning a new cog should be encapsulated within the object in which the routine resides. If you open the Keyboard.spin you will see it spawns a cog to handle the keyboard. You are spawning a cog, which spawns a cog then lets the former cog die. You should instead replace the first line with "pad.start(27,26)".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • bambinobambino Posts: 789
    edited 2006-12-11 14:04
    Thanks Graham,Paul

    Sorry about the delay(no internet at home).

    I will try that when I get home out of curiosity, as I stated before when I put the routine in a sub routine it worked fine.(Then I found the monitor object last night and I had to slap myself for recreating the wheel here).
Sign In or Register to comment.