More simulator serin woes

lauriet

Member
I have a device communicating with a 14M2 via bluetooth, with an app installed that has controls that send signals in the form ControlID, space, ControlValue (though the form is editable), so I have a speed control that sends "7 100" (no quotes), for instance.
It's all coming along nicely, but the ControlValue is not transferring correctly, so I am trying to simulate the code action. I tinker with the code, but it is approximately :
Code:
 do
serin C.3, T9600_32,#b0,#b1
select b0
	case 7 w1 = b1
endselect
loop
I enter "7 100" (no quotes) in the Serial Terminal Simulation of PE6, as ASCII, and see the results stepping through the simulator
The results I get are many, varied and surprising, depending on what parameters I try changing, but I cannot yet find the format to get the result I seek, nor always understand the logic of what I do get (I am no expert in this area).
Can anyone advise on the Serial Input and/or correct code format to get the desired result? Or point me to a description of Serin action when more than one byte is required?
Thanks.
 

hippy

Technical Support
Staff member
There does seem to be an issue which we will investigate. A workround, and also an easy way to simplify data entry when simulating, is to use -

Code:
#Picaxe 14M2
Do
  [b]#IfDef SIMULATING
    SerIn C.3, T9600_32, b0, b1
  #Else
    SerIn C.3, T9600_32, #b0, #b1
  #EndIf[/b]
  SerTxd( "b0=", #b0, TAB, "b1=", #b1, CR, LF )
Loop
Then with Raw mode selected in the Terminal window you can just enter 7,100 etc without any quotes.
 
Top