[UTIL] [WIN] Smiley Terminal with source code

Go To Last Post
22 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I have given up on getting the documentation done on this in a reasonable time so I thought I'd go ahead and release the source code and a quick start guide so that I can get some beta feedback as I finish up the extended documentation.
The quick start guide starts out with:

Quote:
Microcontroller developers often want their systems to talk to a PC, but they run into the problem of having to use an arcane terminal like HyperTerminal, which wasn’t designed to talk to microcontrollers and fights you at every step. Other terminal programs are available, but none that I could find provide the source code in C#, which is the best thing going for creating PC Graphical User Interfaces (let the flame wars begin…).

This article provides a SharpDevelop project and C# source code for the Smiley Terminal application. It further includes a program and source code for the AVR Butterfly to talk to the Smiley Terminal.

SharpDevelop is an open source IDE for using C# with .NET, and works great except when it doesn’t (sometimes you have to CTRL-ALT-DEL to shut it down), so just keep in mind that it is FREE and I won’t respond to complaints about it.

I have appended a zip file containing the Terminal, Terminal Quick Start Guide, SharpDevelop source code, and Butterfly Pinger source code.

You will have to have .NET on your computer to run this. If you don't already have it you can get instructions in the Terminal Quick Start Guide. And fair warning, it is huge so you might not want to proceed if you don't have a broadband connection.

Also the MacroData.xml file must be in the same directory as the Terminal.exe for it to run.

I request (as in down on my knees teeth gnashing) that anyone who uses this provide feedback on any bugs, issues, or concerns by either posting here or contacting me directly at joe@smileymicros.com.

I hope you'll find this a useful learning and development tool.

Smiley

Attachment(s): 

Last Edited: Sun. Dec 18, 2005 - 09:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I decided to hijack this post to list bugs.

First off, the files when downloaded from AVRFreaks are all named index.php :roll: . You may be able to rename them to the name listed for them and have them work. I've also put them all in a zip file on my website under the Link menu called Smiley Terminal Alpha.zip which you can get to at: www.smileymicros.com.
.

Bugs:
12/20/05 Port enumeration bug
line 167 of the DevInfo.cs file only reads single digit COM ports. Fixed by chaning line 167 to:

for(j = 0; j < 8; j++)// JWP 12/20/05 changed 6 to 8 to accomodate up to COM255

12/20/05 Incorrect Windows Desktop Icon
Added a link to the Smiley icon in the source code.

Smiley

Attachment(s): 

Last Edited: Tue. Dec 20, 2005 - 10:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

first download :)

will be fun to check out, been wondering what this c# was all about..... terminal have some useful functions too..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Smiley,

Would it be possible for you to provide a little more information on SharpDevelop and C#? A few how to paragraphs perhaps? I really would like to be able to develop slick setup programs for some of my AVR projects.

JTS

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Smiley, great idea. I'm interested but ran into a problem - when I try to open the Quick Start guide zip file, I get the following error:

Quote:
Cannot open file: it does not appear to be a valid archive.

The other two zip files are fine.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JTSBell wrote:
Hey Smiley,

Would it be possible for you to provide a little more information on SharpDevelop and C#? A few how to paragraphs perhaps? I really would like to be able to develop slick setup programs for some of my AVR projects.

Well like the first sentence of the OP says, ummm... nope. I'm in the process of writing a longish chapter for my next book on using C# to create PC side microcontroller communication GUI's and Smiley Terminal will be the central part of that chapter, but it is coming slow what with the day job and family and AVRFreaks and Smiley Micros and the thing with sheep that I don't like to talk about. But I intend to post a beta of that chapter here as soon as i finish it and let some of you guys tell me about all the horrible typos and stupid mistakes I made. (Much better here than in an Amazon review.)

donblake wrote:
Smiley, great idea. I'm interested but ran into a problem - when I try to open the Quick Start guide zip file, I get the following error:
Quote:
Cannot open file: it does not appear to be a valid archive.

The other two zip files are fine.

I couldn't get any of them to download just now (downloaded index.php -- what's with that? :roll: ) so I posted them on my website www.smileymicros.com under the links menu.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I couldn't get any of them to download just now (downloaded index.php -- what's with that? ) so I posted them on my website www.smileymicros.com under the links menu.

I read somewere on the forum that the there is a bug on AVRFreaks that renames the file to index.php.

http://avrfreaks.net/index.php?n...

Quote:
Broken since the second last attack: The download function is still fubar, at least from IE. This is not a problem for seasoned users as we will know that we can see what the file should really be named, and rename it from "index.php" to the appropriate name while saving. For the noobs it might be more of a problem though... And it's still slooooow.


My AVR Site

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
using C# to create PC side microcontroller communication GUI's

This sounds like a job for a program generator....this would eliminate the need to program at all and you could churn out custom rs232 comm apps with pretty much any sort of bell or whistle you wanted...custom design of the gui and custom graphics are also easy. I am really good at making win32 apps that can generate other programs or modify themselves at runtime. I have never played much with rs232 communications but I could probably pick that up as there is so much freely available data on the web. If this sounds cool smiley I can do some work on it over Christmas break. I would imagine that a program generator for custom rs232 apps would come in under 150kb and the generated apps under 100kb. Dot Net silliness would also be avoided.
Quote:
and let some of you guys tell me about all the horrible typos

I'll go through it quickly if you email it to me :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gwen wrote:
Quote:
using C# to create PC side microcontroller communication GUI's

This sounds like a job for a program generator....this would eliminate the need to program at all and you could churn out custom rs232 comm apps with pretty much any sort of bell or whistle you wanted...custom design of the gui and custom graphics are also easy. I am really good at making win32 apps that can generate other programs or modify themselves at runtime. I have never played much with rs232 communications but I could probably pick that up as there is so much freely available data on the web. If this sounds cool smiley I can do some work on it over Christmas break. I would imagine that a program generator for custom rs232 apps would come in under 150kb and the generated apps under 100kb. Dot Net silliness would also be avoided.
Quote:
and let some of you guys tell me about all the horrible typos

I'll go through it quickly if you email it to me :)

Gwen,

I appreciate the offers. Unfortunately I don't think I'll have the chapter ready until after Christmas.

"Dot Net silliness" - I'm not too sure what you mean, I'm thinking that .NET is the next step in Microsoft Windows evolution and that soon everything Microsoft will run on the .NET platform. I could easily be wrong about that.

Finally, I'm also not sure about automatic program generators. Do you know of something that could generate a program like the Smiley Termimal that would be easier than just using an IDE like SharpDevelop or C# Express and writing the C# code? You say 'custom design of the gui and custom graphics are also easy' -- again I'm not sure what you mean. Using C# is not 'hard' in the way using C++ was, but I'm not familiar with any 'easier' way to do it. Especially using free software. More information please.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's just that Dot Net is such a huge download for some people...and that makes me shy away from it.

Back when I first started with Delphi I was looking for a way to modify a running exe and I did it by modifying the sectors that hold the exe on the hd while the exe was actually running..windows is too stoopid to notice. But everyone was scared to death of the technique so I came up with another method and created a delphi unit called exemod.pas.
Ever since I made that unit I tend to make every piece of software I write in such a way that it can modify itself and also save modified copies of itself as a new exe...this allows you to customize the software in almost any way. Adding custom graphics by just selecting a jpg is very easy as is changing the layout of the gui. I have never created a terminal program but it seems that it might be a good fit to a program generator...that way you could in just a few minutes make a new version with custom abilities and custom layout/graphics without writing any code or firing up a compiler.

I have been trying to think up some good apps I could write to make life easier for AVR users...maybe this is a good candidate. I could wait until your terminal app is complete and then make a version that looks/works like it but is capable of generating modified copies of itself.

If anyone is interested you can find exemod.pas here at Torry's huge Delphi website.
(I wrote it 3.5 years ago so it's not up to my standards now, but I'm too lazy to re-do it)

http://www.torry.net/pages.php?id=268

Also, here is the first program I wrote when I was creating exemod..it is a simple floppy disk copier app that creates little stand-alone exe's that contain the data from the disk and can make copies...it is customizable in many ways and you can easily add a custom image to it.. (the exe's look like little floppy disks) my old computer died before I could finish this app (the old pink monster) so this is an early beta.
http://www.geocities.com/gacarpenter386/e2ademo22.zip

also here is a simple lpt port application that I wrote using exemod...it worked great on w98..not sure how well on XP?
http://www.geocities.com/gacarpenter386/portie.zip

Even very complex program generators end up being no larger than the size of the Exe2A floppy copier app as it is rather involved and huge (108kb)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gwen,

I'm not sure I totally follow what you are doing, but I may be doing something similar with C# in that I have a program that reads an XML file to get a variety of 'brand' specific data such as the names of .jpg files to be used as background images for components, text to use as labels or website links, colors of buttons and sliders, etc. This could easily also be used to set the location and size of windows and components. Using this I can write the low level engine for a project and then rebrand it for each new customer. What I'm doing is very similar to 'skinning' a program like is done with the Windows Media Player. A program that reads its configuration data from an XML file could just as easily write the XML with different data and the open a new instance of itself that would look and even operate completely different. I'm not sure that I see what you are doing that is essentially different in outcome. More 'splain'n please.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
More 'splain'n please.

I guess the big difference is I keep all data inside the exe.. I never have any data that is in a seperate file. Anything that needs changing gets changed right inside the exe itself. And the exe is generally quite small.

No XML
no ini files
no dll's
no readme files
no external help files
no external images (add them right into the exe itself)
If other exe's are needed I just store them inside the main exe.
If a data log needs to be kept I keep it right inside the exe.
(the exe grows to fit)
No downloading and unziping updates..the program grabs the new exe and
just turns into the new exe before your eyes...the old exe just
ceases to be...also you can store a tiny amount of data on a website
inside an html comment and the program can fetch the html and modify
itself in many ways...no need for an entire new exe just to get a small
patch.

And when you generate a new copy of the app everything gets
stuffed inside it and the exe has access to all the data without
looking at external files.

I just like to keep everything together in one tidy package :)
(there are demos of all this stuff on my website)

When I get good enough at C I am going to port exemod to that language.
Maybe C# as well, if it's not to hard for me to learn.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gwen,

C# is relatively easy, relative to C++ that is. I understand it is comparable in complexity to Java. Its main advantage IMHO is the drag and drop graphical components. I doubt that you could manipulate exe files in C# as you do in Delphi, the reason being that .NET programming languages while looking like the original language whether C#, VB, C++, J++ or whatever are actually tranlated to a Common Language Runtime that is then run on the .NET framework. The .NET framework is very particular about letting the programmer mess with anything that might be dangerous. You can get around .NET by invoking Win32 API functions directly and doing this would likely allow you to mess with exe's, but you'll need to be a Win32 guru or at least have some preexisting code that does it for you. In Smiley Terminal I do the serial communication by invoking Win32 API calls, but I had examples from a MSDN article on how to do that and I doubt I could or would have taken the time to figure it all out myself. Win32 API is a bear!

Your ideas about putting everything in the exe file is very interesting. Is the data you put in exe file readable if you open the exe file in notepad? The reason I'm asking is that if the data is not readable then this might be a good way to doe some data obfuscating to block prying eyes.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The data held in an exe can be either readable or not...it's something you can decide when you build the exe. It is very easy to scramble the data. RC4 is an easy way to get hard encryption/decryption while simply using XOR is very fast and useful against the clueless :)
It's also easy to compress the data and decompress..when you do this you automatically add some abfuscation

When you pull data out of the exe you have the option of deleting the data from the exe at the same time..that way the exe will shrink as you extract data files...this is great for an installer program.

When I get home I could make you a simple demo in a few minutes that would let you see how easy it is to alter an exe by selecting a txt file to stuff into it...I can put 2 buttons..one would scramble the data and one would not...when not scrambled you could see it in wordpad or textad.

I just love to play with exe files...stuffing stuff into them..pulling stuff out...making copy protection schemes...driving crackers crazy with exe files that change every time they run or every time they shut down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gwen,

That would be cool to see, but I'm commited now to using C# for the development work. Even though the .NET framework is huge, it is free as is the SharpDevelop IDE, but the Delphi things, while excellent, must be purchased. Also I really do think that .NET is where WinTel will go in the future. There is nothing wrong with Delphi, but for my audience I want to stick to as many free tools as possible.

Thanks for all the enthusiasm, it is a joy to see.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is cool is that I can make a program generator using Delphi and that program generator becomes a free tool that makes other tools :)
As I advance in my abilities with the AVR I am sure I will discover something that a free program generator can be useful for...
You can even create a simple computer language with Delphi if you extend the generator idea far enough.

Maybe a generator that writes simple AVRGCC programs for beginners would be useful.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
You will have to have .NET on your computer to run this

. NET 1 , . NET 1.1 or . NET 2?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have both 1.1 and 2 installed on my PC. You should too, js, as it makes life a whole lot easier....

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Net 1.1 should do it.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I have both 1.1 and 2 installed on my PC. You should too, js

BUTT I do too :-)....remember that I have VS2005 which MUST have .NET 2 to run.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Smiley, looks like you have done some great work here.

Sadly, .NET 2 actually includes a SerialPort component which handles alot of the settings and communications which you have coded yourself :/ I don't know if SharpDevelop supports .NET 2 yet (I got Visual Studio 2005 free from work), but SerialPort makes these things very easy. I whipped up a simple terminal (very primitive compared to yours) in about 10 minutes with it.

[EDIT] To anyone who is interested, I just remembered that Microsoft has released "Express" (free) IDEs for all their new .NET 2 products. You should be able to find them by poking around msdn.microsoft.com. Let me know if anyone needs me to dig up a link.

Chris

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the kind words. I did all that serial stuff several years ago based on John Hind's article in MSDN. It was the only free thing available at that time. It may be obsolete now, but I at least learned how to use P/Invoke to call Win32 API functions and that has come in handy a few times to circumvent other C# shortcomings.

I thought I'd investigate the serial namespace in .Net 2 and got the 'free' edition from Micro$oft which basically ate my machine. It installed a SQL server that took over as a user and would not let me kill it since I didn't have it's password. I had to restore a pre-Express backup to get rid of the damn thing. So, I've been lurking around to see if anyone else is having problems with Express before I try it again. It seems to be okay and my experience may just be a personal gift from Bill to me.

I'm still mulling over this. M$ free is for a limited time, and may or may not turn out to be forever, but even if they do charge, it won't be a lot so who knows. I suspect it is free until we debug it for them, then they'll charge us.

Anyway, the serial stuff works and wouldn't handicap a user of Express if they wanted to port the code. The code is worth looking at if only for the way it fakes skin that doesn't look so Windoze 1984 gray. Also, the XML stuff comes in very handy for me when I'm debugging microcontrollers.

Smiley