Keyboard Shortcuts
Likes
Search
Re: Help with EZGPIB
Thanks Harvey; I was hoping for a simple answer such as: Sname:=EZGPIB_ConvertStripToNumber(Sname,Sname,Sname); // where Sname is the string Or some variation that uses commas, colons, quotes, or other punctuation. I looked through all the sample code and examples from Ulrich Bangert and found nothing (that I understood anyway). I tried some guesses and came to the conclusion that this function will not do what I want. ? I went through all the functions and found the ? EZGPIB_ConvertRemove(What:string;FromWhere:string); Removes all instances of ¡°What¡± in ¡°Where¡± ? This is the total description and a novice programmer, like me, does not really understand how to use this when there are no examples. What exactly do I put in the brackets? I tried different things until the compiler stopped complaining. I probably have it wrong even though it works. ? I also went through a Pascal tutorial but it does not go beyond simple strings. Strings separated by commas may be regarded as an array, or more than one string. I am not a programmer and writing a page of code to replace three lines is asking for frustration. ? So the following works ? EZGPIB_ConvertRemove('NZFN', Answer);??? ??????????? // Answer is the string EZGPIB_ConvertRemove('NTDN', Answer); EZGPIB_ConvertRemove('K', Answer); ? but with the correct punctuation it might be written as one line such as ? EZGPIB_ConvertRemove('NZFN', Answer; 'NTDN', Answer; 'K', Answer); ?// does not work ? Attempts at variations gave compile errors like ¡°too many variables¡± ? My complete program is not very elegant but is easy to understand and modify, and it works. It sets up the 4192A to display Magnitude, Phase, and Frequency. Then it starts with a frequency, and step frequency, and reads 9 times (e.g. 1kHz to 9kHz in 1kHz steps), the step frequency is increased and 9 more reads are taken (e.g. 10kHz to 90kHz in 10kHz steps), this is repeated again (e.g. 100kHz to 900kHz in 100kHz steps). If this was the last loop then 10 reads can be taken (e.g. 100kHz to 1000kHz in 100kHz steps). All reads are appended to the end of a buffer and upon completion the buffer is read to memory. Copy and paste makes variations easy so any of the units the 4192A can calculate can be read. The 4192A is quite versatile but is 1980 technology so the 7470A plotter was not yet invented and I have to work within the limitations. The same program with slight modifications will control the HP4193A Vector Impedance Meter. If there is no simple improvement then I will post the program to a file in a 4192A folder. Maybe an expert could re-write it to be easier to use. I cannot see how to pass variables to the EZGPIB functions and could not find suitable examples to follow. ? This is an interim solution as I would like to move on to a C++ program that could be more interactive. Perhaps someone has already written such programs in C++. ? My present program is this: Program HP_4192A_Project;????????????????????? ??????????????? // LF Impedance Analyzer // Note this is a work in progress. It acquires 3 freq decades of Z, phase, and Freq ? ?const filename= 'C:\users\user\My Documents\GPIB Prologix\HP4192A_Data.txt'; ?? HP4192A???? =16;????? ?????????????????????????????????????????????????????? // LF Impedance Analyzer ?? Timeout?? =10.0;????? ?????????????????????????????????????????????????????? // ?var Answer:string; ???? i:integer; ???? begin ? ezgpib_screenclear;??????????????????????????????? ???????????????????????????????????? // Clear output console screen ? EZGPIB_ScreenWriteLn('HP 4192A Project');? ? ? ? ? ? ? ? ? ? ? ? ? // display title ? EZGPIB_fileclearbuffer;????? ??????????????????????????????????????????????????????? // clear buffer ?if EZGPIB_FileExists(Filename)then EZGPIB_fileDelete(Filename); // delete old file ? EZGPIB_BusWriteData(HP4192A,'A1B1T3F1');?? ??????????????????????????????? // Z, deg, hold/manual trig, display A/B/C ? EZGPIB_BusWriteData(HP4192A,'FR1EN');????????? ??????????????? // Spot Fequ 1 kHz ? EZGPIB_BusWriteData(HP4192A,'SF1EN');????????????? ??????????? // Step 1kHz ? EZGPIB_BusWriteData(HP4192A,'ABW0');?????????????? ?????????? // Abort Sweep, Manual Sweep for i:=1 to 9 do begin; ? EZGPIB_BusWriteData(HP4192A,'EX');???????????????? // Trigger ? EZGPIB_BusWaitForData(HP4192A,Answer,Timeout);??? // Get data ? EZGPIB_ConvertRemove('NZFN', Answer);?????? ??????????????? // delete NZFN ? EZGPIB_ConvertRemove('NTDN', Answer);?????? ??????????????? // delete NTDN ? EZGPIB_ConvertRemove('K', Answer);??????????????? ??????????????? ??????????????? // delete K ? EZGPIB_FileAddToBuffer(Answer);? ???????????????????????????????????? // add to buffer ? EZGPIB_ScreenWriteLn(Answer);????????????????????? ??????????????????? // Display on screen ? EZGPIB_TimeWaitForMultipleOf(1);?????????????????? ?????????????????? // Delay 1 seconds ? EZGPIB_BusWriteData(HP4192A,'W2');???????????????? ?????????????? // Step up end; ? EZGPIB_BusWriteData(HP4192A,'SF10EN');???????????? ?????????? // Step 10kHz for i:=1 to 9 do begin; ? EZGPIB_BusWriteData(HP4192A,'EX');???????????????? // Trigger ? EZGPIB_BusWaitForData(HP4192A,Answer,Timeout);??? // Get data ? EZGPIB_ConvertRemove('NZFN', Answer);?????? ??????????????? // delete NZFN ??EZGPIB_ConvertRemove('NTDN', Answer);?????? ??????????????? // delete NTDN ? EZGPIB_ConvertRemove('K', Answer);??????????????? ??????????????? ??????????????? // delete K ? EZGPIB_FileAddToBuffer(Answer);??????????????????? ?????????????????? // add to buffer ? EZGPIB_ScreenWriteLn(Answer);????????????????????? ??????????????????? // Display on screen ? EZGPIB_TimeWaitForMultipleOf(1);?????????????????? ?????????????????? // Delay 1 seconds ? EZGPIB_BusWriteData(HP4192A,'W2');???????????????? ?????????????? // Step up end; ? EZGPIB_BusWriteData(HP4192A,'SF100EN');???????????? ??????? // Step 100kHz for i:=1 to 10 do begin; ? EZGPIB_BusWriteData(HP4192A,'EX');???????????????? // Trigger ? EZGPIB_BusWaitForData(HP4192A,Answer,Timeout);??? // Get data ??EZGPIB_ConvertRemove('NZFN', Answer);?????? ??????????????? // delete NZFN ? EZGPIB_ConvertRemove('NTDN', Answer);?????? ??????????????? // delete NTDN ? EZGPIB_ConvertRemove('K', Answer);??????????????? ??????????????? ??????????????? // delete K ? EZGPIB_FileAddToBuffer(Answer);??????????????????? ?????????????????? // add to buffer ? EZGPIB_ScreenWriteLn(Answer);????????????????????? ??????????????????? // Display on screen ? EZGPIB_TimeWaitForMultipleOf(1);?????????????????? ?????????????????? // Delay 1 seconds ? EZGPIB_BusWriteData(HP4192A,'W2');???????????????? ?????????????? // Step up end; ? EZGPIB_FileWrite(Filename);??????????????????????? ?????????????????????????? // write to file
end. On Tue, Feb 5, 2019 at 12:20 AM Harvey White <madyn@...> wrote: On Mon, 04 Feb 2019 15:36:34 -0800, you wrote: |