Are there some instructions somewhere (perhaps in the manual) that show what the simulator does, and how to interpret the results?
#picaxe 08M2 #no_data init: pwmout C.2,100,150 ; start pwm main: readadc C.1, B1 ' read pot, store ADC value 0-255 in B1 if b1<128 then reeverse foreward: high c.4: b2=b1-128: goto speed reeverse: low c.4: b2=128-b1 speed: w2=8*b2 pwmduty C.2,w2 ; set pwm duty goto main
Yes, SERTXD is a cool tool. We see it used in code all the time.You do much better with a targeted SERTXD, where you can include text to show where you are in the program and what values you are displaying.
You the coder are the targeter, I'm afraid. You determine what you need to know, and write the SERTXD to display it.Where are the secret instructions hidden in the manual to use "targeted SERTXD"?
I don't know what that means, but never having used DEBUG in my code, perhaps I don't know what I should be looking for.Debug launches in the simulator even when that command is not in the code!
#picaxe 28x2 symbol DESIRED_POT=12 ' some ADC channel number do sertxd("On channel ",#DESIRED_POT, ", ADC value read = ",#b1,cr,lf) b1 = b1 + 10 ' just to provide a changing value for b1 pause 3000 ' time to look at the output loop
That's rather the wrong way around. The Simulator IS a "Debug Window". The Simulator is basically just an "Array of Numbers" that are updated by reading a sequence of instructions (i.e. the program) in the Editor. IF it didn't show the "numbers" to a User, then there wouldn't be much point in using it! In practice, there are additional Wizards and device Emulations included in the Editor/Simulator, but that's just Rev. Ed. being helpful to Students (or their teachers).Debug launches in the simulator even when that command is not in the code!
sertxd("On channel ",#DESIRED_POT, ", ADC value read = ",#b1,cr,lf)I'd recommend that you try it in the simulator, with, for instance:
main: for b1 = 0 to 63 ; start a loop sertxd("The value of b1 is ",#b1,13,10) pause 1000 next b1
First, CR and LF are predefined constants in PICAXE BASIC which stand for Carriage Return and Line Feed. The constants have the values of 13 and 10, You can see these ASCII characters defined in the ASCII table here: https://www.asciitable.com/sertxd("On channel ",#DESIRED_POT, ", ADC value read = ",#b1,cr,lf)
It looks like:
"On channel ", is the first statement.
#DESIRED_POT, is 12 which is the second statement.
ADC value read = " is the variable.
,#b1 is the address of the data.
but what is ,cr,lf) ??
Is it a location position in the Serial Terminal?