Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

what language should I use?

Status
Not open for further replies.

curious125

Mechanical
Nov 3, 2003
39
0
0
CA
I am trying to create a user interface (gui) that will display information that is being sent to a microcontroller.

I'm not clear on what language the interface should be coded in? I know that some languages are very resource intensive, but I don't know the who's who.
I was hoping to be able to send/recieve data in realtime.

What would be the best suited for this application?
 
Replies continue below

Recommended for you

Where is this GUI hosted? That's more relevant than what language. The OS on which it resides may be limited to only C.

How fast does it need to be? That could also limit you to C.

TTFN
 
the OS will more than likely be win2k, or XP at a stretch.
I just want to be able to read/write data in realtime.
The other thing I was wondering about was if the serial port would be too slow, and be forced to use USB. Since I'm a relative "newbie" to programming and I think it might be a little much.
 
What's your perception of realtime? In other words, what width is your data, and how many samples a second are you working with?

If it's only a monitor application, then reading data more than every 10ms is irrelevant in realtime, as the human eye can't resolve that well (persistence of vision). If you need to store the data as well then storage speed may also be a limiting factor.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
I would go for VB. It's quite simple to build an application as the one you described. I've made one with little or no difficulties and had very little knowledge of VB at the time.

Depending on your microcontroller, you can use baud rates that will give enough speed for the application (I used 19200).

If you want to store data, then real time will be a bit harder... I don't know what is the amount of data you'll be saving, and if the application will have any other software sharing the processor. If the amount is small, i would consider keeping it in memory.

Hope to have helped, Carlos Cardoso
 
The processor will have it's own program running. The PC link that I would like to establish would be more of an 'overlord' taking a copy of the same I/O that the microcontroller will be seeing and display the information. I would also like to be able to send variable value changes back down to change the values that are running in the microcontrollers low level programming.

I am willing to use VB to code, but I am concerned about it's required resource loading.
10ms for reading the data is more than fast enough I would think. But if it wasn't what would I be looking at to a read rate of say 5ms?
 
For my final year project in '92 I used a product called LabWindows, which was basically a data acquisition card, which would store the values and allow you to process them 'realtime' using an interpreted C called QuickC

They're owned by National Instruments now (not sure about then, it's so fuzzy)

National Instruments

HTH
--Paul
 
Hi, Let us break the problem into its building blocks..
1-Micro controller part 2- PC part 3- communication part

Micro controllers are now powerful enough to manage a large complicated machine on its own, so actually you can do all processing requirements there. So the need for host PC would be more of human interface, and a little complex arithmatic if needed, beter help support etc..

PC part, beleive it or not, an old 486 with windows 9x will have enough power to do the job, UNLESS we are talking about someting similer to audio or video recording where thousands or more samples per second has to be taken per second and storing it on hard disk as a contious streem.
Just don't run more applications that need much of processor attention, i.e. dedicated pc.

Communication link in PC serial mode can go up to 115200 b/s which translate to about more than 11 kbyte of data per second, and full duplex i.e 11k go and 11k back....
Long distance and noisy industrial environments, use RS485 instead of RS232 (a simple converter will do)

So VB is a breath to use and has a lot of features you may need to write pages of code to get it in any other language.

If you feel that a fuction or group of functions are too extensive and need faster language, write those in other faster language in dll form, like Delphi,power basic dll for windows or even C, still use the vb interface and call that dll as simple as you call vb own functions.

I use this way to replace an old Z80 computer running a fiber processing machine (preparation for weaving and dyeing)
Any more help I will be glad to..

 
That is pretty much what I would like to accomplish.

The mircocontroller will house and run it's own program. The PC is there more or less as a visual interface of the events taking place in the microcontroller.
What i'm not sure about is:
1- will I have to write extra code on the microcontroller to send data to the PC, or can I do it all on the pc side?
2- Can I change a variable that I have operating on the microcontroller via the PC in somewhat realtime, or would I have to change the program and downoad it to the microcontroller anew?
 
All micro controllers are more or less close or similar but I found 89s51 or 52 is easier to understand, so I will use it in my explanation if you don't mind..

I am sure that you know ,all processing devices like PC's micro controllers ..etc are stupid machines, they do what you TELL them to do not what you expect them to do...

So on the micro side, you must write extra code to handle info transfer
A) Deside if commands will be both sides or only one side.
i.e. will the pc give orders (or requests) to micro, will micro give orders/requests to pc ,From your writings I think Yes for both.

B) The rate of exchange data is too much i.e. micro may need to send now, then before it is finished he needs to send NOW again, then you must use hand shaking to avoid data loss. Remember that this may happen between long times of silence between the two.but if data is expected every say 0.1 to 1 millisec (regular intervals) then forget about hand shaking.

C) What data to transfer, and what is a request

D) write a code to send data to pc at micro controller best time (PC works with event driven process so when data comes he will do his job) but to do it other way around, you will need to use interrupt rotines and you should be carefull not to let PC (much faster) dominate the micro with lots of requests and delaying it from its main job - taking care of machine.

E) Wirte a code (If needed) for commands or data need processing on PC and deside how micro will expect PC answer
just stay in a loop or do something then come back to check result or use interrupt.

D) Write the code to read PC command and do what you want it to do in response to each, eg, a code byte tells micro to change "X" variable (value) followed by the new value (fixed number of bytes 'n' to hold the maximum expected value) so the micro upon receiving a code it will check itc list of commands then execute the corresponding code to read (receive the following 'n' bytes and store them in its RAM. now the micro will use this new value till you chang/modify it.

The micro 89s51 or 52 can retain the data when power is off, and no need for backup battery.

PIC also has the same features with some differences but as I said I found 51 series easier to use and understand

Any more help I will be glad

 
Hi Johnwm, CC

Best put my oar in for my own prefered language, Borland Delphi, There are several Serial comms components commercial and freeware that can be added into the Delphi enviroment, Delphi produces 'stand alone code' no neeed for dll's and such, The GUI encapsulates the windows system calls and hides some of the more complex stuff, so its better than VB in that way, and its based on Pascal which is much more user friendly than 'C'.

Steve.
 
of course, there is the question of "why have the microcontroller there if you will also have a PC".

If the PC's presence is required to make the whole thing go, maybe all the processing should be there, with an I/O card to handle interfacing with whatever the microcontroller was going to handle.

cheers
Jay

Jay Maechtlen
 
There are several reasons to do this, to name a few
1- Managing a CRT display is difficult, unless you use LCD display then the output is limited to a few lines.
2- Handling a printer will give a primitive job,while on PC you have a lot more power to print.
3- Error reporting is limited to a line or two at most if you have Enough memory otherwise you display a code while on PC sending the code to pc can trigger context sensitive help file to say how to fix the problem with photos.
4- PC can calculate more data about efficiency, total output, complex math like log, anti-log, triangular data, and sure make it easier to interface to a network if you need.
 
Sorry I had it reversed, actually having maicro controller on the machine helps in 3 things
1- Allow for stand alone operation while still get better user interface when needed.
2- Very much less expensive and safer to have majour jobs done by a micro, unless you switch to a stable operating system like Linux, which programming for may be expensive too.
3- Easier to do the job because I/O board, if still use serial or parallel port will have its limitations, and plugin cards need a driver which is not easy to write.
 
Which Windows variant are you running this front end on and how are you communicating with the microcontroller? If it is serial as one of the MVPs mentioned then the OS doesn't matter. If it is a plug in card, you are in the realm of device drivers for NT/2K/XP.

 
Status
Not open for further replies.
Back
Top