Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic using 2 cogs — Parallax Forums

PropBasic using 2 cogs

camelot2camelot2 Posts: 54
edited 2010-04-28 19:31 in Propeller 1
hi, I am trying to use 2 cogs.In·cog0 I transmit some text to the terminal
and in cog1 I also transmitt some text to the terminal. The text sent in
cog0 gets displayed but the text sent in cog1 does not ! Can someone
show me what I am doing wrong. See my attached file. thanks - Dave

Comments

  • BeanBean Posts: 8,129
    edited 2010-04-27 17:24
    You need to release the serial pin in cog0 by making it an input.

    Something like this:

    SEROUT 30, BAUD, "in coq0"
    TX_BYTE CR
    INPUT 30
    COGSTART Send_Data

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • JonnyMacJonnyMac Posts: 9,235
    edited 2010-04-27 17:26
    One of the problems you will face is arbitration between the two cogs -- if both are writing to the same pin at the same time then your serial data will get trashed. You should set up a global flag so that a cog won't transmit while the other is in process.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • Chuck ThomasChuck Thomas Posts: 39
    edited 2010-04-28 17:09
    Bean,

    I just tried this and got an invaild parameter error. Is this suppose to be coq0 or cog0? Or something eles. I've tried the cog vs coq and still received the same error.



    Chuck
  • BeanBean Posts: 8,129
    edited 2010-04-28 19:31
    Chuck,
    · Here is the modifed file.

    Bean


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
Sign In or Register to comment.