Displaying the Cog ID started by the cognew command ?
JMLStamp2p
Posts: 259
I have used the Methods on page 118 of the Prop. manual and want to
display the Cog_ID·of a new Cog started ·on my serial LCD display. I am using FullDuplexSerial to send the serial data to the display but a little confused about how to display the "Success" varible below·that is returned. Am I right in that the Success varible will hold the number of the Cog started and return that to my Main Method upon exiting ? Does this mean that I have to assign a varible in the OBJ. that contains my Main method ? And if so, could someone give me an example of how to display it via my LCD.
Note: I am using, data.start(1,0,2,9600) To write to the LCD.
Thanks,
JMLStamp2p
............................................
Method Containing Main below
............................................
CON
·_CLKMODE = XTAL1 + PLL16X···
·_XINFREQ = 5_000_000········
VAR
OBJ
·GO: "Sloss Timer Program_TX"
PUB Main
·GO.Start
....................................................
Method that Starts a new Cog below
....................................................
VAR
·long Stack[noparse][[/noparse]9]
·byte Cog
OBJ
·DELAY: "Clock"
·DATA: "FullDuplexSerial"
......................................................................................................·
PUB Start : Success··········· ·'The varible Success Returns the # of the Cog
········································' Started to Main after the Method exits.
·Stop
·data.start(3,2,0,1900)·········· 'Start Cog-1 to handle FullDuplexSerial
·data.rxflush
·Success := (Cog := cognew(Toggle(Pin,Delay,Count), @Stack)+ 1 )
····························· 'Start Cog-2 to handle Toggle
......................................................................................................·
display the Cog_ID·of a new Cog started ·on my serial LCD display. I am using FullDuplexSerial to send the serial data to the display but a little confused about how to display the "Success" varible below·that is returned. Am I right in that the Success varible will hold the number of the Cog started and return that to my Main Method upon exiting ? Does this mean that I have to assign a varible in the OBJ. that contains my Main method ? And if so, could someone give me an example of how to display it via my LCD.
Note: I am using, data.start(1,0,2,9600) To write to the LCD.
Thanks,
JMLStamp2p
............................................
Method Containing Main below
............................................
CON
·_CLKMODE = XTAL1 + PLL16X···
·_XINFREQ = 5_000_000········
VAR
OBJ
·GO: "Sloss Timer Program_TX"
PUB Main
·GO.Start
....................................................
Method that Starts a new Cog below
....................................................
VAR
·long Stack[noparse][[/noparse]9]
·byte Cog
OBJ
·DELAY: "Clock"
·DATA: "FullDuplexSerial"
......................................................................................................·
PUB Start : Success··········· ·'The varible Success Returns the # of the Cog
········································' Started to Main after the Method exits.
·Stop
·data.start(3,2,0,1900)·········· 'Start Cog-1 to handle FullDuplexSerial
·data.rxflush
·Success := (Cog := cognew(Toggle(Pin,Delay,Count), @Stack)+ 1 )
····························· 'Start Cog-2 to handle Toggle
......................................................................................................·
Comments
JMLStamp2p
..................................
PUB Main| Success
GO.Start
Success := GO.Start
data.start(3,2,0,19200)
data.dec(Success)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!