An Easy One
SteveWoodrough
Posts: 190
This one is easy, just hard for me.
Im experimenting with Tim Moores PC Full Duplex Serial 4FC getting data from a GPS and sending to an LCD or PST, etc.
The sample original program had a line like this.
The non-functioning second approach starts a referenced object method in another cog, and that referenced object method repeatedly references another method within the same referenced object.
In theory, both are going to the same place, but the first works and the second does not.
Hopefully this all makes sense. Ive attached the basic code.
Thank You! Steve
Im experimenting with Tim Moores PC Full Duplex Serial 4FC getting data from a GPS and sending to an LCD or PST, etc.
The sample original program had a line like this.
cog := cognew(BackGround,@stack) + 1 'Start the background Cog pub BackGround 'Process gps and camera receive characters 'minimize processing in this cog, i.e. dont send to serial ports e.g. debug 'dont call waitcnt, etc. Dont call blocking receives from serial ports - use rxcheck repeat gps.GetNMEALineAs I looked through the GPS_IO GPS. object I saw a method that read
PUB readNEMA ' if start is called this processes reads from GPS on a COG repeat GetNMEALineSo I got the bright idea to change the cog start from above to:
cog := cognew(gps.readNEMA,@stack) + 1OF course that does not work, but I do not understand why. The functioning first version starts a local method in another cog and that method repeats a method from a referenced object, GetNMEALine.
The non-functioning second approach starts a referenced object method in another cog, and that referenced object method repeatedly references another method within the same referenced object.
In theory, both are going to the same place, but the first works and the second does not.
Hopefully this all makes sense. Ive attached the basic code.
Thank You! Steve
spin
6K
Comments
Tracy Allen cleaned up Tim's code and fixed a few bugs. Here's Tracy's improved object.
Attempting to put what kuroneko stated in my more simplistic words. Don't use "cognew" across objects.