Using DEBUG

Guys, I have tried to do a search looking for topics discussing the use of the DEBUG command for the atom pro 28. I couldn’t find much.

I can have data output to the debug screen using the code below:

 Debug [variable] 

My question is: how can I format debug output to make charts? Pbasic lets you position data to specific X/Y locations. Does Mbasic let you do something similar?

Hi Mike!

Most people use the terminal instead of debug. Not sure why.

serout S_OUT, i57600, [variable, 13]

There are many modifiers that you can use in the command. You can cut and paste from the terminal window, but you would have to make sure your program includes the proper delimitors for inputting into your spreadsheet program.

Great! Thanks! I will try the S_OUT method tonight.

I typically use the S_OUT method as it works in both debug and nondebug mode. One problem with using debug mode it is very often changes the timings of things, so I only use it when I wish to step through the code to see how it is working… I also use the onboard LEDS for helping me find out if different parts of the code are being called…

The Pro manual does have a little information on the debug command, where it says things like: a Null character will clear the screen. A decimal 7 will ring the bell, … It also states that a more complete listing is in the IDE documentation. Maybe now that they have hired some documentation writers this part will be more fully documented.

Kurt

LOL! I just did this last night. I set the Green led to notify the start of the main program and Red led to indicate the end. I wanted to see if it was doing the entire main program. Since I don’t have the SSC-32 connected to the bot board I cant see any action, but I wanted to test out the other parts of the code to make sure it was working. It proved very helpful.

I tried the code example and it didn’t do anything. I know I am doing something wrong. I tried setting up the terminal to com1 and com3 using 57600 but I don’t know what the heck I’m doing.

[code]main:

mydata var word
mydata = “testing”
serout S_OUT, i57600, [mydata, 13]

goto main[/code]

Not sure exactly what you are wanting here. But setting Mydata = “testing” may not work well.

You can try things like:

mydata var word for i = 0 to 10 serout S_OUT, i5700, "Testing: ", dec i, 13] next i

You should setup the terminal to which ever IO port you use to program the Atom or Pro. Are you using one of the terminal windows at the bottom of the IDE or some terminal program? If another program your comm port may be causing the CPU to reboot (DTR). There are several threads on this. Try putting some sound at the beginning of your program. If you start to get continuous sound you know your program is resetting…

Kurt

I was trying to add string data to the variable mydata and have it output to the terminal window. I am trying to migrate from Pbasic to Mbasic and the debug command works very different in Mbasic.

For example: the code I wrote for the Audio sensor a long while back output debug data in a formated text screen that updated the values in real time.

DEBUG CLS, ' Print display "ADC08x32", CRSRXY, 0, 7, "Differential", CR, CR, " Ch0:", CR, " Ch1:"

I was hoping to do the same thing with Mbasic but its looking like my lack of understanding is going to get the best of me.

I have tried the two available comports which is com1 and com3 when I run in debug mode, nothing happens. I am going to try and mess around a little more and see what happens.

When you run in debug mode, S_OUT may not work very well as the comm port is being used by the debugger…

Kurt

How do you use S_OUT to work with the Atom IDE terminal? I have tried everything with no luck. I tried using Debug, Program, and coms 1, and 3 for the terminal. Nothing works which tells me I must be way off base on how to setup and use S_OUT as a debug output tool.

EDIT<<

I opened the Atom Pro manual PDF and did a search using the search tool for “DEBUG” and found the information I was looking for. I could not find it in the printed manual I have for some reason. I don’t care if I use S_OUT or DEBUG, I just want to have a way to output data to check what’s going on in the program with some formatting abilities. The Information for the DEBUG command and formatting parameters start on page 99 and ends on page103 for those who might want to know. I don’t know why I can’t get any output using the SEROUT method. I will figure that out some other day I guess.

Mike, you caught the fact on the IDE terminal that you need to set the baud rate… and tell it to connect, yes? And obviously the baud rate needs to match the serout s_out baud rate in your program…

Also don’t try to mix serout s_out and the debugger… in theory I suppose i’s possible, but just pick one or the other and work it out. :wink:

Hello Eddie,

Yeah, I set the baud rate to 5700 (whats with me and baud rates?) and clicked connect button using com1 which is the com port the atom pro is connected to. I ran the program and it didn’t do jack. :laughing: I’m using the first release of 8.0.1.8 and have yet to download any of the other patches. Anyway, with out any documentation on S_OUT other than one line code example in the manual, I really have no clue as to what I am doing. I paste the code in the IDE, set the baud rate, set the com port click the connect button and hope that some how by magic that those settings will give me some results. :laughing:

Assuming you meant 57600 baud. I don’t remember off hand whether the S_OUT uses inverted polarity or not so try it both ways. I had this working at one point but I think I was only using 9600 baud so maybe try knocking that back… really all you need to start is proof of concept which you can apply to your “real” code.

You may need to download and run the program before connecting the terminal in the IDE… I don’t remember if it was smart enough to figure that out on it’s own or not. You could make the program pause until you press one of the buttons on the ABB which would give you time after downloading to switch tabs and connect the terminal.

Excellent! This is of great help! I did mean 57600. I agree, all I need is a working example to use to rule out errors on my part narrowing down the issues to the proper procedure you described such as the order in which I do things.

Thanks Eddie. :smiley:

Hi Mike…

Your program Atomized…

[code]mydata var byte(7)
mydata = “testing”

main:
x var byte
for x=0 to 6
serout S_OUT, i57600, [mydata(x)]
next

goto main[/code]

I cut and pasted this from the terminal window…

testingtestingtestingtestingtestingtestingtesting

Now if I can do this. (I’m a programming idiot!) I’m sure you can. hehe

The terminal settings for me are 57.6kbs, com1, no parity, no flo, echo…

I think I have you beat… :laughing:

Thanks Jim I will try this tonight! 8)

WALA! It works!

Cut -n- pasted from the terminal window:

testingtestingtestingtestingtestingtestingtestingtestingtestingtestingtesting

Way to go Mike! I knew you could do it. :wink:

To make this program functional without making many changes to it do this:

[code]main:

mydata var byte(10)
mydata = “testing”
serout S_OUT,i57600,[str mydata\7,13]

goto main[/code]
I made your word variable into a byte array to hold your string

The STR modifier allows you to output a byte array in a command like serout. The “\7” tells the STR modifier the maximum length to send.

Also, just so you know a WORD variable does not mean it’s a variable designed to hold text words(eg “testing”). It means the variable can store a word sized value which is equal to two bytes. That is why I changed it to a byte array. Each byte of a byte array can hold one character of any text.

Hey Nathan thanks for the tip! I learned something today. :wink: