Shop OBEX P1 Docs P2 Docs Learn Events
(Solved: I was using an older version of the Prop Tool) Why not indexed objects? — Parallax Forums

(Solved: I was using an older version of the Prop Tool) Why not indexed objects?

Duane DegnDuane Degn Posts: 10,588
edited 2021-02-09 03:27 in Propeller 2

I'm experimenting with the multi port serial driver and I see this code:

OBJ
  ser    : "mpx_fullduplexserial"       {clusos multiport serial driver (based on jonnymacs serial) - suports fdx port}
  ser2   : "mpx_fullduplexserial"                          
  ser4   : "mpx_fullduplexserial"                           
  ser6   : "mpx_fullduplexserial"                          
  ser8   : "mpx_fullduplexserial"                           
  ser10  : "mpx_fullduplexserial"                           
  ser12  : "mpx_fullduplexserial"                          
  ser14  : "mpx_fullduplexserial"                          
  mpxcog : "mpx_multiportserialdriver"   {multiport serial pasm driver in its' own cog}

It sure would be convenient if I could use the following instead of what's listed above:

OBJ
  ser[8]    : "mpx_fullduplexserial"     { clusos multiport serial driver (based on jonnymacs serial) - suports fdx port}
  mpxcog : "mpx_multiportserialdriver"   {multiport serial pasm driver in its' own cog}

I'm very excited about all the possibilities the Propeller 2 opens up but I'm also a bit frustrated by changes in Spin which appear to make the language a bit more cumbersome.

If the serial objects were indexed, each port could be checked using an incrementing index.

Is there some reason this couldn't be done in Spin2?
Edit: Fixed code blocks. I changed the way comments were indicated.
Edit: I'm in the process of updating the Propeller Tool. Hopefully this will take care of things.

Comments

  • cgraceycgracey Posts: 14,133

    You can have many instances of objects and index them. Not sure why it's not working for you.

  • Duane DegnDuane Degn Posts: 10,588
    edited 2021-02-09 03:05

    I get the following error.

    I'm using the Propeller Tool 2.2.0.0 alpha.

  • I see I'm not using the latest version of the Propeller tool. I'll upgrade now.

  • Duane DegnDuane Degn Posts: 10,588
    edited 2021-02-09 03:28

    Things work fine in the latest version of the Propeller Tool.
    Sorry for griping about nothing.
    The Propeller 1 changed my life for the better (I enjoy my work programming Propellers much more than I enjoyed working as a chemist). I think the Propeller 2 is going to be just as awesome as the original.

  • @"Duane Degn" said:
    Things work fine in the latest version of the Propeller Tool.
    Sorry for griping about nothing.
    The Propeller 1 changed my life for the better (I enjoy my work programming Propellers much more than I enjoyed working as a chemist). I think the Propeller 2 is going to be just as awesome as the original.

    You also provide lots of constructive help to people on the forums and we welcome the gripes.

    Ken Gracey

  • Cluso99Cluso99 Posts: 18,069

    @"Duane Degn" said:
    I'm experimenting with the multi port serial driver and I see this code:

    OBJ
      ser    : "mpx_fullduplexserial"       {clusos multiport serial driver (based on jonnymacs serial) - suports fdx port}
      ser2   : "mpx_fullduplexserial"                          
      ser4   : "mpx_fullduplexserial"                           
      ser6   : "mpx_fullduplexserial"                          
      ser8   : "mpx_fullduplexserial"                           
      ser10  : "mpx_fullduplexserial"                           
      ser12  : "mpx_fullduplexserial"                          
      ser14  : "mpx_fullduplexserial"                          
      mpxcog : "mpx_multiportserialdriver"   {multiport serial pasm driver in its' own cog}
    

    It sure would be convenient if I could use the following instead of what's listed above:

    OBJ
      ser[8]    : "mpx_fullduplexserial"     { clusos multiport serial driver (based on jonnymacs serial) - suports fdx port}
      mpxcog : "mpx_multiportserialdriver"   {multiport serial pasm driver in its' own cog}
    

    I'm very excited about all the possibilities the Propeller 2 opens up but I'm also a bit frustrated by changes in Spin which appear to make the language a bit more cumbersome.

    If the serial objects were indexed, each port could be checked using an incrementing index.

    Is there some reason this couldn't be done in Spin2?
    Edit: Fixed code blocks. I changed the way comments were indicated.
    Edit: I'm in the process of updating the Propeller Tool. Hopefully this will take care of things.

    Sure you can used indexed ser ports.
    However, I'm using the same object to do LCD and shortly other interfaces too.
    So ser[4].txchr("a") doesn't make much sense if its and lcd where I prefer lcd.txchr("a").
    Then again, something general might be better too, like out[n].txchr("a").

Sign In or Register to comment.