Jump to content
Sign in to follow this  
NJC

Programming Tips

Recommended Posts

So, I am not sure if this is the right forum to post this in, but here goes nothing.

 

I know a lot of you came from the software world before trying out hardware one way or another. So, I am seeking some advice from all of you software people. I will soon embark on a journey which will take me through the depths of number crunching and crazy algorithms. I will be writing a program which will implement a pretty hardcore algorithm for pattern recognition which is VERY tolling on computers.

 

Anyways, I have done some research and decided that I will be programming it in C#. I know this is the kind of thing that one uses CS people for, but that really isn't an option for me. Basically, I was wondering if anyone had any tips or knew of any resources online that would help me program something that's very performance intensive like this. The main problem is that this needs to be done in real time on a data stream (coming from an MSP430 :-P). I have a bit of experience with threading, but not in C#; I assume I will need to use threads effectively to do all of these calculations.

 

Guess I am looking for any generic advice or tips; things to look out for I guess.

 

NJC

_________________________

http://msp430launchpad.com

Share this post


Link to post
Share on other sites

I've never used C#. Not tips, but I had done this some time back - so maybe useful. I had to get in live images(15fps) from a camera(640*480) and process them for pattern recognition. I used Linux(Fedora) as a platform, coded everything from C and used Intel's OpenCV library as a part of my algorithms. It worked pretty well in the end. Part of it can be seen at the links below:

 

Also if you are trying to visualize something on the PC, Processingis good. I'm trying to find the time to learn it.

Share this post


Link to post
Share on other sites

The one thing wrong with Processing is that it's very resource intensive itself, not to mention terribly slow compared to other languages which compile natively such as C#.

 

I don't have any experience with threading in C#, as I've never used the language, but I would suggest looking up C/C++/C# optimization techniques, and then applying them within your individual threads.

Share this post


Link to post
Share on other sites

Threads seem pretty easy in C# (from what I had to deal with in class). If you have experience in threading, I think you should pick it up quickly. I rely on the MSDN documentation on line quite a bit. It's kind of hit or miss; sometimes the examples are really clear and helpful, sometimes they go in the complete opposite direction to where you wanted to go.

 

BTW: C# does NOT compile natively; it is compiled to an intermediate code that is compiled at runtime by the Just-In-Time compiler. It is very fast, but there is a reason that games are still coded in C/C++. That said, it should be plenty fast enough (on a reasonably modern machine) to keep up with the data stream from an MSP430 (even at high rates).

 

-Doc

Share this post


Link to post
Share on other sites
My b, that was a misinformed assumption on my part. I try to avoid the Microsoft branded languages like the plague.

 

meh. No biggie. It's kind of like Java in the way it works.

 

I can understand trying to stay away from MS stuff. They tend to make stuff expensive and bloated. Alas, it's what I've used where I've worked (aside from a little Java). It's nice to get down to a very basic C on the 430!

 

-Doc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×