Thursday, October 31, 2013

Power Supply Programming Part 2: What Type of Programming Language to Use

Happy Halloween Watt’s up fans!  Today I want to look at what programming language you are going to use to write your program.  Instead of recommending a particular language, I am going to break it down by graphical versus text based programming.

Let me start by saying that there really is no correct answer to this question.   This is a matter of personal taste.   

I am going to start with a bit about my background.  Unlike most of my colleagues, I did not specialize in analog electronics in college.  I focused more on computer engineering.  Due to this specialization, I have taken quite a few programming based courses.  I prefer sitting down and programming using a text based programming language because of my background. 

 Graphical programming languages are a very popular option (Agilent VEE is the one that I am most familiar with).     I find these programs are great for doing short programs.  If something can take up less than one page on your computer screen, then it works pretty well here.  These languages also make building user interfaces really easy since there are a lot of easy to access functions for controlling and displaying instrument data.  I personally find that they get very unwieldy if you want to send and read a lot of data with an instrument.  I also find the looping constructs to be strange.   People have told me that these graphical languages look very similar to circuit diagrams and I can see how people would prefer that kind of view to just plain text programming.

I am going to make a confession.  If I have to write a program quickly and I do not have to show it to anybody, I still will write it in HPBASIC.  I find it to be very easy to do simple instrument programming.  There is no need for drivers, once it is set up properly; sending and receiving information with an instrument is a breeze.    Large programs do not fare very well in HPBASIC though.

My preferred way to program these days is Visual Basic (using VISA-COM IO).  If you look at the power supply example programs that we provide, there is a lot of VB in there.  I feel that a text based program allows you to write much more compact code. It takes up a lot less screen space than an equivalent graphically based language.  Something like Visual Basic is also more versatile since it is not only for test and measurement but for more general applications.  The looping constructs work very nicely here and to me the flow makes more sense.  I also find typing quicker than connecting boxes.  Text based programming does have some cons though.  For one, the graphical languages are written from the bottom up to do instrument control.  They have built in functions and data manipulation that make thing easier.  The graphical languages also have some really good libraries for building User Interfaces. 

 The real correct answer to the questions is the best language to use is the one that you are most comfortable programming in.  If you think that I missed any pros or cons please feel free to share in the comments.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.