Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Serial Port Communication White Paper (http://www.chiefdelphi.com/forums/showthread.php?t=4574)

Dave Flowerday 06-06-2002 16:41

You know, I just thought of something else. IBM has this cool technology called Sash that I've read about. It basically uses simple languages like JavaScript and HTML to create what they call a "Weblication" which is really a full fledged program. A description from the IBM site:
Quote:

Weblication is the IBM name for a Sash application that uses Web technologies such as HTML, JavaScript, and XML. Sash Weblications also take advantage of operating system functionality (file system, networking, and user interface). Sash Weblications are built using the Sash Weblications Developer Kit (WDK). The WDK makes it easy for you to develop and publish Sash Weblications on the Web
You probably don't want to start fresh on your project but you may want to check it out for future projects. I've personally never tried it but it sounds cool. It has the potential to make it easy to write GUI applications while still allowing you to work with the hardware (serial port, networking, etc.). Check it out at IBM's Sash site.

It's all free, BTW.

DanL 06-06-2002 16:52

Okay, let me clarify the design of our dashboard program a little bit.

The key element that we want to have is style and visual apeal. Now, since refresh rate isn't that important, we decided to make the display in Flash.

The problem is that Flash only does scripting - not any real programming. It's designed for the web, not real programming. As I see it, the only way to get Flash to read the info from the Dashboard is to use the import data options in Flash.

Flash has two ways to inport data. One is to read from a text file, and the other is to get it in through a server-side script - php, asp, cgi, etc. (remember, flash was designed for the internet, not programming). To get it from a server-side script, I suppose the best way would be to make it read from a database. However, 1. we don't know how to access databases in C/C++. and 2. even if we could, I'd think that having the C++ store the info in a database, then have flash request the info from a php page several times a second is a bit slower than the alternative.

The second way flash imports data is by a text file. We decided the fastest way would be to have the C++ proggie running in the background and constantly rewriting the text file while the flash proggie reads the data and displays it in style.

Yes, we realize this isn't the most efficient way, but again, our priority is style over refresh rate. The goal of this proggie is more of something that shows off to potential sponsors or visitors what we can do - not something for debuging the robot like StangSense (which is something I'd definately like to learn more about some other time).

We did consider that this would be very inefficient. However, to test just how inefficient it was, Ian and I created two small test proggies. The C++ one basically wrote to the text file one variable in an infinite loop, and the flash displayed it. Using just one variable and no additional calculations, the refresh rate is still better than we expected - easily about 10 times per second. I'm not sure how the additional calculations (both decoding the data sent in and the calculations required in the display proggie) will affect speed, but it should be good enough for our purposes.

DanL 06-06-2002 16:55

Quote:

Originally posted by Dave Flowerday
I wonder if the Flash app can use a pipe? I know some applications on Windows use pipes, so it's possible...

For those who don't know, a program works with a pipe similar to the way it works with a file, except there's no file. This would be a perfect application for a pipe. Basically, the program reading the serial port could write the data stream to the pipe, and the Flash program could read the data from the pipe. This is what I think you're trying to do now, except it eliminates the disk from the equation, and solves the file locking issues that rbayer was talking about.

Flash I'm pretty sure can't do that - as I explained, Flash just imports either through a text file or through a server-side script. But I'm sure Macromedia has taken this into account. I'm pretty sure other Macromedia things like Director or ColdFusion are designed more for what we're trying to do, but don't hold me to that.

rbayer 06-06-2002 17:10

Quote:

last thing, can anyone think of any way to jump out of the endless loop besides 'ctrl + c'?
The only way I can think of is to constantly monitor the keyboard and quit if you hit a certain key.

As for having the serial port and file open, it should work. Using regular fstreams, you can have as many files open as you want--no limits as far as I know. Same thing with Windows handles.

Ian W. 06-06-2002 17:45

ok thanks. only one more problem then. how can i moniter the keyboard without stopping every loop cycle? i know about cin and fin (fstream). that's all. both stop until data is put in and the 'enter' key is hit. that wouldn't do. there must be some way around this, anyone know how? cause if that works, then the program will actually work better than i expected :D

Dave Flowerday 06-06-2002 17:56

Quote:

Okay, let me clarify the design of our dashboard program a little bit.

The key element that we want to have is style and visual apeal. Now, since refresh rate isn't that important, we decided to make the display in Flash.

The problem is that Flash only does scripting - not any real programming. It's designed for the web, not real programming. As I see it, the only way to get Flash to read the info from the Dashboard is to use the import data options in Flash.
Yeah I understand your need for a nice looking GUI for this and that's exactly why I suggested Sash. What I understand of it is that it allows you to simply and easily code up fancy GUI programs but also allows you to retain access to serial ports, hardware, etc which Flash does not. Like I said, you wouldn't want to restart your program with this instead by any means, but for future projects it might offer a little more flexibility.

I'm not trying to imply that your design isn't good or won't work. It's actually a pretty common way to pass data around. I was just trying to help think of ways that you can improve the throughput without sacrificing the visual effectiveness of the project. It sounds like you've done the appropriate testing and are confident that this solution will work, so best of luck and keep us posted!

Also, I wrote a program that spits out fake Dashboard port data for use in testing our Palm app for StangSense. Ian mentioned that you are losing access to your robot after this weekend, so maybe this could help. I could probably revive that and you could then hook two PCs together and have one pretend to be the operator interface if that would help... You also might be able to hook a PC up to the Operator Interface and just capture the Dashboard data to a file using Hyperterminal which you could then play back to the other PC. We never got that to work for us (hence the program to generate Dashboard data) but maybe you'd have better luck.

Ian W. 06-06-2002 18:18

yes, a program like that would be great. i just wish i could take home the extra OI/RC and some joysticks... it's not like i'd break it. heck, i carried a school laptop around at all the competitions. it still works, sorta :D.

Ian W. 06-06-2002 18:21

also, i'm going to look into that sash thing. seems interesting, so i'll try it over the summer. heck, if i can figure it out, i might just start over. never hurts to do something twice.

SlamminSammy 06-06-2002 18:23

Quote:

Originally posted by SuperDanman
Okay, let me clarify the design of our dashboard program a little bit.

The key element that we want to have is style and visual apeal. Now, since refresh rate isn't that important, we decided to make the display in Flash.

The problem is that Flash only does scripting - not any real programming. It's designed for the web, not real programming. As I see it, the only way to get Flash to read the info from the Dashboard is to use the import data options in Flash.

I recommend using C, C++, or PERL to create an ASP program that feeds into a website. Using Adobe Illustrator you can create a very appealing dashboard:)

rbayer 06-06-2002 20:06

I'll have to check that Sash stuff out too...

Anyway, if you can't get that to work, try the VC++ resource editors. They are simple to use and allow you to create powerful MFC-based programs even if you don't know MFC (sounds impossible, but its true). Also, if you're looking to learn real Windowing/Messaging/GUI stuff this summer, and you want to do it for Windows, I'd recomend you find a copy of Charle's Petzold's Programming Windows. It's a GIANT 1400 page book and is far and away the best one on the Windows API that I have ever read (and it presents it in such a way that you will be able to make the switch to MFC fairly easily later on). Anyway, that was my summer reading last year, and it's what I used to write my RoboGUI program.

Anyway, if you need any real-time help, I'll be on ICQ for the rest of the night while I work on some of my programming projects. #152894206.

Ian W. 06-06-2002 22:15

[edit]

i figured out my problem, so no need to show my stupidity :p

[/edit]

Greg McCoy 06-06-2002 23:20

Nerd Vandalism
 

Dave Flowerday 07-06-2002 00:07

That's pretty cool! [Except for the defacing other people's property thing...] This one's my favorite:


Jay Lundy 07-06-2002 00:21

Quote:

Originally posted by rbayer
Also, if you're looking to learn real Windowing/Messaging/GUI stuff this summer, and you want to do it for Windows, I'd recomend you find a copy of Charle's Petzold's Programming Windows. It's a GIANT 1400 page book and is far and away the best one on the Windows API that I have ever read (and it presents it in such a way that you will be able to make the switch to MFC fairly easily later on).
Yes, it's a great book. It's what I've been using to learn Windows programming this summer.

Greg McCoy 07-06-2002 15:46

Quote:

Originally posted by Dave Flowerday
That's pretty cool! [Except for the defacing other people's property thing...]
It wasn't me! :D

I got the picture in an email, and I think the billboard was somewhere in England.


All times are GMT -5. The time now is 22:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi