Shop OBEX P1 Docs P2 Docs Learn Events
send to serial from a different cog (PASM), or not — Parallax Forums

send to serial from a different cog (PASM), or not

iammegatroniammegatron Posts: 40
edited 2015-05-13 16:30 in Propeller 1
I have "FullDuplexSerial" object loaded/started in the "Main" spin code. I can call "serial.tx(a_byte)" to send to serial port.

In the "Main", I also "cognew(@a_different_cog,0)" running assembly code in another cog.

What is the best way for "a_different_cog" to call "serial.tx()" (indirectly) to send its data to serial port?

Some ways I can think of, for example:

1. to signal between two cogs, is to toggle GIO lines.

2. to write to a common HUB RAM address, setting flags etc.

3. ...

Comments

  • kwinnkwinn Posts: 8,697
    edited 2015-05-13 16:30
    The code running in the other cog cannot "call" serial.tx. What you can do is have some code in the main cog monitor one or more variables that the other cog writes to and have that main cog code call serial.tx and pass the data to it. Your #2 choice IOW.
Sign In or Register to comment.