QBASIC Dashboard Program

Hello Everybody,

I have started working on a dashboard program in QBASIC for this year’s OI. I chose QBASIC because it is simple enough, and I know how to do some things in it.

I have already been able to open the serial port, detect which frame in incoming, and store the input stream in a 26-byte arrary. However, I am having a strange problem when attempting to display the values. If I use print to output the parts of the array, I get the ascii character representing the byte in the element of the array. This is a problem, as letters and ascii symbols are not easily parsed by humans. Is there a way that I can output data from the print command, out of a character variable, in a decimal format?

Also, for those teams working on a dashboard program, do not repeatedly set and unset the DTR pin. The OI tends to act flakey until it is reset if you do so.

It’s been SEVERAL years since I’ve touched QBASIC, but I’m about 90% sure you’re looking for the ASC$ function.

PRINT ASC$(A)

Can you download programs to the '04 OI? How?

No, the OI is not programmable.

The idea with a dashboard program is that it is run on a computer that is hooked up to the dashboard port on the OI. The OI reports this information through the db port, and then the program picks up the bytes and displays them in some meaningful fashion.

Anyway, congratulations on your achievement! I didn’t know it was possible to access the serial port in QBASIC. Good job!

Thanks Jeff,

Also, thanks KevinB. The ASC$ function was able to help me display the data correctly. I had never used that function before.

As soon as I make some good, usable dashboard code in Qbasic, I will post it. I am having a number of problems, such as the program crashing Windows 9x machines if it is run when the OI is off. Also, occationally the computer is unable to synchronize with the input frame of 26 bytes (especially if at least one byte is a 255) and displays garbage for a few frames.

Now I have a question for programmers out there. Qbasic is not particularly suited to visualization. I was only planning on using it to read the data from the serial port and feed it into something fancier. No Screenmode 13 graphics here =).

I was planning on having Qbasic output data into textfiles, stored on a Ramdisk. Then, I was thinking of using a few perl scripts and a webserver, to have the data available in a web browser. Can any of you tell me about any different (better) schemes for showing off data?

In the off-season, a friend of mine and I came up with a system where we wrote all the data to 40 or so different text files in order, then overwrote the first one again every second or so, and so on. Then we used Macromedia Flash (much more suited to visualization) to read the files and display the data.

You can do it a lot easier than this :smiley: Just put a Macromedia Flash ActiveX control on the form in VB (or Delphi, or any other environment that supports ActiveX). You can then set variables in the Flash movie directly. The Flash movie can interact with your program using the fscommand() function.

If you can handle C or C++, you could write a frontend that uses OpenGL or some other graphics library to display the collected data in real time.

In C/C++ combine OpenFile with ReadComm/WriteComm.

In VB, use the MSComm control.

Exact code can be found at Microsoft’s MSDN:

http://msdn.microsoft.com/

There are OpenGL (And DirectX, VB only compiles to windows) for VB.

If you can get a hold of a licensed version of the MSComm, You can put it in VBA. In word, open the Visual Basic toolbar, and press “Visual Basic Editor”. It’s not quite the same, but close enough. If anyone wants to know how to use the MSComm for dashboard, Ask and I’ll send some sample code I got from this site.

I have a hunch that the terminal window in the IFI_Loader just outputs what it receives from the COM port (Ascii characters, no interpretation). Can any anyone deny/confirm this?

I wrote a Qbasic Dashboard program and it works well enough to share.

It

-detects packets
-saves the data into an array
-performs basic processing of the data
-displays data on screen
-cleanly handles COM port errors

Right now it is set up to read the OI, not the RC. Simply modify the “SELECT CASE 4” by changing it to “SELECT CAES packnum” in one of the subs to use the RC data instead. This is untested. There might be a bug with the PacketFrame!() Function.

If you simply load this program and run it, it may take two or three tries to connect. Just tell it to retry a few times. You should set Qbasic (or the compiled program) to run on compatibility mode for windows 98 if you are running XP. Windows XP does werid things to the COM port… To do this, right click on icon, properties, (etc).

If you use this code, please let me know and mention team 937. I don’t check this board often, so email questions to kvogt {AT} everestkc.net.

-Kyle Vogt
-Team 937

TEAM937.zip (2.6 KB)


TEAM937.zip (2.6 KB)

Heres a link to the dashboard program.

http://www.innovationfirst.com/FIRSTRobotics/pdfs/2003_Dashboard_Spec.pdf

I like your code, Camel85kv. Thanks for the file.

For those of you unable to open the file, it was saved with QuickBASIC 4.5 (not QBASIC). I have QuickBASIC (purchased it years ago), but I recognize the fact that very few people do. I am posting a text version of Team 937’s fine work here. The text version is compatible with QBASIC.

text team937.zip (1.71 KB)


text team937.zip (1.71 KB)

Thanks for the kind words! You are right, QuickBasic is a bit harder to find than the original QBasic. I’m glad you pointed that out because that file is jibberish to people without QuickBasic. Let me know if something does not work.

-Kyle Vogt
-Team 937