Need help with Cogs
Guys I need some help here..
When a command comes accross cog1 , and fires the runspeaker and the speaker does do what it is suppose to then the boxes quits operating correctly. I cant figure out whats happening. If I do not run the speaker command then everything continues to operate fine. What seems to be happening is the box quits responding. Can anyone see something that I am not?
When a command comes accross cog1 , and fires the runspeaker and the speaker does do what it is suppose to then the boxes quits operating correctly. I cant figure out whats happening. If I do not run the speaker command then everything continues to operate fine. What seems to be happening is the box quits responding. Can anyone see something that I am not?
pri XbeeReader repeat XB.API_Rx case XB.RxIdent $81: IF(strcomp(XB.RxData,string("1"))) 'This Fires makes sound then System seems to go ofline. RunSpeaker IF(strcomp(XB.RxData,string("2"))) Identify BeamOffLine IF(strcomp(XB.RxData,string("3"))) RespondImHere IF(strcomp(XB.RxData,string("9"))) Hot := true RespondOnline IF(strcomp(XB.RxData,string("0"))) Hot:= false RespondOffLine
Comments
I How about that..
I would suggest using PST for debugging and insert a line at the beginning of the “XbeeReader” routine to display the value of “XB.RxData”. Keep in mind that XB.RxData must also be a string (an ascii 1 followed by a binary 0).
The issue that i am seeing is that the case runs correctly , and the Runspeaker runs and completes. After that it seems that the box will not transmit again until I reset the box.
If I understand it correctly:
now the Main Sub runs in Cog0
then the XbeeReader runs in Cog1
is there some state that is happening to the Cogs that i need to reset after the runspeaker completes?
In the above statement, String 2, 3, and 9, work correctly. string 1 and 0 do not. Could that be because im using 1 and 0 there and it is getting confused somehow? I might need to check that.
I added the 2 above lines and that function started working. Im currious. Is there something to do with the VAR being shared between 2 cogs?? Cog0 is My spin and Cog1 which runs the XbeeReader is another spin. Xbee_Object_1. Just a guess, but is there something special that I should do there to make that Var more available between the 2 cogs? it honestly is acting like its hit and miss on reading and writing it, kind of like they are not insync between the 2 cogs?
As the SPIN stack grows towards higher addresses and this stack array being the last long entry you basically clobber your word/byte variables.