Shop OBEX P1 Docs P2 Docs Learn Events
Looking for ideas on how to get multiple instances of an object with assembly. — Parallax Forums

Looking for ideas on how to get multiple instances of an object with assembly.

andrewsiandrewsi Posts: 59
edited 2010-11-01 16:09 in Propeller 1
So I'm working on a project where I'd like to have two serial terminals running at once - one from the Demo board's onboard programming port, and one from a second FTDI USB->Serial converter I hooked up.

Using the Parallax Serial Terminal library object with the first port is child's play, but it doesn't seem to work as a multiinstance object once you hook up the second port. I'm wondering if this is because the two cogs are sharing a single DAT instance of the code and perhaps there is global data in main memory getting stomped? Or is this expected to work and I'm just writing a bug in my code somewhere else? I'm just using the standard 'pst[2] : "Parallax Serial Terminal" OBJ definition and STARTing the two instances independently. (I also modified the object to take pin parameters on the Start method so as to not assume that it's using the programming pins on the demo board in all cases.)

I do seem to be able to make things work just fine using one instance of PST and one of Simple_Serial.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-01 16:05
    Some objects are written so that their variables are defined in DAT sections so they can be shared from several different objects. I think PST is one of these. If you want different instances, use something like FullDuplexSerial which works that way. In other words, FullDuplexSerial can be declared multiple times and each declaration provides a separate serial port although the code is reentrant and is not duplicated. Only the buffers and a few variables are unique to each instance.
  • andrewsiandrewsi Posts: 59
    edited 2010-11-01 16:09
    Thanks, I'll take a look at the Full Duplex object, maybe that'll work better for my purposes.
Sign In or Register to comment.