EZGPIB - return a value in functions - Page 1
Forum section: electronics / testgear

author: pelule
author_rank: Frequent Contributor
timestamp: January 31, 2016, 12:52:47 pm
content: Hi I have opened a new topic, hope did it at the correct group.Short description of EZGPIB:EZGIP is a Windows running free PASCAL like script processing software to control tools via VISA/GPIB/RS232 easily. It does not create an executable.The creator of that sw unfortunately passed away, but that tool is still in use in the community.My question: is EZGPIB unable, to return a value of a function?When i detected that issue, I used a simple in PASCAL fully correct test functionQuoteEZGPIB stops at marked position and claims "invalid number of parameters"Anyone, having experiance with EZGPIB, able to confirm my finding & conclusion?BRPeLuLe

author: Earendil
author_rank: Regular Contributor
timestamp: January 31, 2016, 03:50:15 pm
content: What happens if instead of fAdd := A + B; you write Result := A + B; ?I would also try declaring the function this way: Function fAdd (A : Integer; B : Integer) : Integer;

author: pelule
author_rank: Frequent Contributor
timestamp: January 31, 2016, 05:43:43 pm
content: Thanks for the tip.Will try and report the findings...PeLuLe

author: edpalmer42
author_rank: Super Contributor
timestamp: January 31, 2016, 05:45:08 pm
content: Did you look through the example programs for a similar function?

author: pelule
author_rank: Frequent Contributor
timestamp: January 31, 2016, 06:15:52 pm
content: QuoteYepp, that was the first I checked, as I thought it may a user failure. But I found no example using a function returning a value.Aslo check the manual. Doid not find any information on.Thus my question to the community...EZGPIB is actual running on a measurment log (noise measure) so need to wait to test the tip, until finished.PeLuLe

author: edpalmer42
author_rank: Super Contributor
timestamp: January 31, 2016, 07:34:35 pm
content: This doesn't look right, but it works. EZGPIB uses a 'magic' variable called Result to return results from a function - it's shown in some of the examples. Not sure why you can't specify the calling parameters. I think that the Pascal engine in EZGPIB is Remobjects (http://www.remobjects.com/ps.aspx) with some custom extensions. I don't know if there's any documentation on the specific syntax for Remobjects. I do know that there are some errors in the syntax of the extensions - things like commas and semicolons, so step carefully.If you want to run a second copy of EZGPIB, just do it. As long as you're not fighting for specific hardware, I think it works okay. Worst case, copy the relevant files to a different directory and run the second copy from there.Code:Program TestFunction;ConstA = 2;B = 9;Function fAdd : Integer;BeginResult := A + B;End;BeginEZGPIB_ScreenWriteln(fAdd);End.

author: pelule
author_rank: Frequent Contributor
timestamp: January 31, 2016, 08:12:16 pm
content: Great tips and good hint for the scripting source (May help in future for specific issues).The "Result" as function return value work, have noted in my manual printout.I guess they did it as a quick solution without having problems on type checking and stack manipulation.That's not trivial as I know (have written C and PASCAL compiler in my early times myself).BRPeLuLe