Board logo

Programming advice
turbodisplay - 4/9/09 at 08:50 AM

Can someone point me in the right direction regarding programming in C++.
I`ve finished making my digital dashboard (case still needs to be made using cast ali ).
Now i need to make a serial port editing program (like megatune for megasquirt). I think C++ will be the best bet from what i have found so far.
I have experiance at uni of C and java so have a basic understanding.
Any books/ websites that wil be useful, or and libiaries that will help me build a program will be grateful.
Thanks
Darren


rallyingden - 4/9/09 at 10:25 AM

What controller / display are you using ?

RD


turbodisplay - 4/9/09 at 10:32 AM

its a pic chip, with lcd and led display.
it the pc software i`m interested in. i wrote the chip software in assembly as it is so effcient.
Darren


rallyingden - 4/9/09 at 11:02 AM

I think I have a copy of visual studio 6 at home.
I'll check tonight.

RD


BenB - 4/9/09 at 11:20 AM

quote:
Originally posted by turbodisplay
its a pic chip, with lcd and led display.
it the pc software i`m interested in. i wrote the chip software in assembly as it is so effcient.
Darren


Good effort. Low level programming is definately the way forward when it comes to PICs (not much room for bloat)!!

I once wrote a program in both TP6.0 and x86 assembler. The x86 program was so much faster (disk transfer was the limiting factor) and so much smaller...

Not sure I'd fancy writing a windows app in x86 though


Gav - 4/9/09 at 11:46 AM

Personnally for a windows app to talk to your dash via RS232(?) i would use C#, c like syntax but sooooo much easier to design a windows app using windows forms or WPF than using MFC with C++.

You can get a free copy of C# Express from Microsoft


craig1410 - 4/9/09 at 12:14 PM

If you have experience of Java then why not just use it?

The small performance hit you will get with Java (and C#) compared to C++ will not affect the sort of application you are writing given the processing power you have available. Besides pure performance, Java has all the advantages of C++ and avoids some of the complexities of C++ programming. Java and C# will perform in much the same way but with Java you don't have to learn the basics all over again. Having said that, you will probably spend more time learning the libraries/frameworks than learning the basics.

If you've not already done so, look at Netbeans or Eclipse for a full-featured Java IDE (Integrated Development Environment) and I'm sure you will be productive in no time. Compared to either of these IDE's (esp. Eclipse) I find Microsoft Visual Studio to be horribly slow and clunky to work with.

By the way, I write apps commercially in lots of languages including C, C++, Obj-C, Java, VB, VB.Net, Oracle PL/SQL etc and I always feel most comfortable with Java on Eclipse. For me, it seems a good balance between powerful features while still feeling "connected" to what is going on beneath the surface.

I hope this helps,
Craig.


MikeRJ - 4/9/09 at 02:37 PM

Writing windows apps in C++ is hard work and overkill for most situations IME. Java usually works fine for simple GUI type appplications e.g. TunerStudio MS is a Java app. The trendy alternative would be one of the .NET languages.

If you want to compile native applications for speed then Delphi/C++ Builder are both pretty easy to use.


turbodisplay - 4/9/09 at 06:04 PM

Thanks rallingden.
Thamks for the replies. I find this site really is the font of all knowledge!
I have limited java experience as it was just a insight. As it was sometime ago i will be learning from almost scratch.
I will look into java. I remember the last time i looked into it the runtime environment put me off.
I was thinking there might be a better language to learn for future projects.
C# i will also look into.
Darren


craig1410 - 4/9/09 at 08:00 PM

quote:
Originally posted by turbodisplay
Thanks rallingden.
Thamks for the replies. I find this site really is the font of all knowledge!
I have limited java experience as it was just a insight. As it was sometime ago i will be learning from almost scratch.
I will look into java. I remember the last time i looked into it the runtime environment put me off.
I was thinking there might be a better language to learn for future projects.
C# i will also look into.
Darren


If your aim is to write an app to communicate via the serial port then you might want to look into specifically what is involved in using the different languages for that purpose.

I can certainly say that handling the serial port is very straightforward in Java because I have 4 years experience of developing and supporting a handheld ferry ticketing application which runs on Windows CE based handhelds and talks to a ruggedised, belt mounted printer via the serial port. It also does credit card authorisations, again via the serial port. The communications are bi-directional and run using a separate thread to handle asynchronous incoming data (ie. it handles incoming data at any time, even when it not expected and processes this via an event queue). I have tried in the past to do similar things with Visual Basic (not VB.Net admittedly) and I had all sorts of weird issues with serial port control. It seemed straightforward but ultimately didn't work reliably. I think the issue was with the MSCOMM control if memory serves.

Having said all that, I would urge you not to take my word for it and check it out for yourself. Perhaps someone on this forum might have more recent experience of serial comms using VB.Net or C#. Maybe the issues I had have since been resolved.

Let me know if you need any help on the Java side if you decide to go that way.

Cheers,
Craig.

edit: here's a website I stumbled across. It's quite old but may prove useful:

http://alumni.media.mit.edu/~benres/simpleserial/

and

http://www.captain.at/howto-java-serial-port-javax-comm-rxtx.php

and here is the Java based system called Eve which I use on my mobile ferry ticketing app:

http://www.ewesoft.com


[Edited on 4/9/2009 by craig1410]

[Edited on 4/9/2009 by craig1410]


MikeRJ - 4/9/09 at 08:15 PM

The MSCOMM control used in VB5 and VB6 certainly has a few foibles, but it does (mostly) work. I've quite a few applications at work that use it, though using it in a polling manner rather than event driven does seem to make things more reliable. It's also possible to use the Win32 API through VB, avoiding the MSCOM control altogether, though this somewhat misses the point of a simple drag and drop control.

If you don't mind using a slightly outdated language than VB6 has a lot going for it in terms of sheer simplicity and ease of debugging. I still use it occasionally in preference to .NET if I want to quickly knock up a simple application for my own use.


craig1410 - 4/9/09 at 08:21 PM

quote:
Originally posted by MikeRJ
If you don't mind using a slightly outdated language than VB6 has a lot going for it in terms of sheer simplicity and ease of debugging. I still use it occasionally in preference to .NET if I want to quickly knock up a simple application for my own use.


I agree, I develop & support a number of VB6 based applications and prefer VB6 to VB.Net mainly due to the much simpler and more reliable IDE. It's a bit sad as VB6 is so old now but it is quick to produce windows forms based apps that is true.


Madinventions - 5/9/09 at 12:50 AM

VB6 would be absolutely fine for this, or VB.NET would look a lot more modern. I use both every day for work purposes and they're so much easier to use than C++.

I've also built a digital dash for my car using a PIC 18F8722 but I steered well clear of ASM for this. I usually use MCC18 for most projects, but I've moved over to a BASIC compiler called 'Swordfish' (linky) for this project. It has let me incorporate a touch screen GLCD, SD memory card for data logging and I'm just adding in some video overlay code using the MAX7456 from Maxim. Let me know if I can help!

There's some info on my website if you're interested.

Ed.
click here


turbodisplay - 5/9/09 at 11:01 AM

Thanks guys. I will also look into vb6.
Mad i`m impressed with the chip you are using, it was too difficult to solder those chips in so i used a 18f4620, 40 pin dip.
|Even with assemly language it is over half full!
Thanks
Darren


MikeRJ - 5/9/09 at 11:07 AM

I used to use PIC's at work, then moved on to AVRs and now have moved onto the ST ARM Cortex parts. Very fast, 32 bit micros with excellent GCC support and loads of memory for similar prices to an 8 bit PIC!

The slight downside for hobby use is the packages, but LQFPs aren't that bad to solder by hand with a bit of practice.