Calling the same object multiple times
Earl Foster
Posts: 185
I am calling the FullDuplexSerialPlus.SPIN object·3 times in my program to communicate·with the·3 seperate serial devices listed here.
1. Serial Terminal Debug
2. Serial GPS
3. Serial USB Drive
I know the compiler only compiles one instance of the object but am I using·3 additional COGs in my program since fullduplexserialplus.spin requires a new COG?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
WWW.HAPB.NET
"Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
1. Serial Terminal Debug
2. Serial GPS
3. Serial USB Drive
I know the compiler only compiles one instance of the object but am I using·3 additional COGs in my program since fullduplexserialplus.spin requires a new COG?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
WWW.HAPB.NET
"Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
If the Serial GPS and Debug Terminal don't need to talk at the same time, you can use the Propeller Tool's Simple_Serial library. Whatever cog calls its method ends up doing the serial communication. No new cogs, but don't go over 19.2 Kb/s.
An alternate approach would be to call one FullDuplexSerial (or ...Plus) object's start method to successively reconfigure it. The start method stops the cog if it's running and then launches with the new settings. Your application code may have to do a little footwork to make sure the FullDuplexSerial object's Start method doesn't get called in the middle of sending or receiving bytes, and it might also be necessary to set pin states from the cog that calls the FullDuplexSerialPlus methods so that they don't float when the FullDuplexSerial cog lets go of them when it moves on to another set of pins.
Some notes regarding versions: Get the Propeller Tool v1.2 for the latest Simple_Serial object. If you continue to use FullDuplexSerialPlus, make sure to use version 1.1, which is available from the Objects Lab, v1.1 or newer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 7/7/2008 10:15:14 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
WWW.HAPB.NET
"Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman