PDA

View Full Version : Global TV_Text



John Abshier
11-10-2006, 05:49 AM
My Spin program is structured
·· SRF08Demo· ' object to call SRF08 and print out some results
····· tv : "TV_Text"·· ' writes to TV
····· RF : "SRF08"····· ' object that reads SRF08 ultrasonic rangefinders
I would also like to write to the TV from the SRF08 object, but it cannot see the name tv.· If I add a new TV_Text object in the SRF08 object, both try to control the tv and the display is hosed.· Commenting out all references to the TV_Text object in the top object to write out a quick debug in the SRF08 object is a pain.· I guess I could write to the USB2Serial chip on the Demo board, but that requires closing the Propeller Tool, another pain.· When debug screens (like in PBASIC) are added, it would be nice if different objects could open different debug screens.· Have I missed the cool way to handle this situation or is it just something I will have to live with?

cgracey
11-10-2006, 05:54 AM
Well, the object heirarchy cannot be gotten around. Only the object that contains TV can talk to it. I think what you'll need to do is have the object that contains TV, go ask HRF08 for some data, and then send it to the TV, itself.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Chip Gracey
Parallax, Inc.

John Abshier
11-10-2006, 06:01 AM
That what I would do if my program were working correctly. I am trying to debug where my program is hanging.

Mike Green
11-10-2006, 09:17 AM
There is a way to do this, but it would involve changes that you're probably not prepared to do. The Propeller OS that I wrote is able to do this by separating out the variables that the display uses from the routines that manipulate them. The variables are all referenced by a pointer at a specific location in memory. Two different objects can include the display routines since each copy has none of its own variables and they all reference the same global copies. (You would need to use a semaphore with LOCKxx if the two objects were running in separate cogs).

Another thing I've done to debug routines in different cogs is to use both a TV driver and a VGA driver at the same time with one handling the debug output only.