Thanks Harvey, I will keep this last reply online for anyone that wants to control one of these impedance meters/analyzers with EZGPIB. I just made some runs with a Chinese Test Fixture which pointed out how many things may need to be changed in the program. There are Series and Parallel modes on the 4192A and the characters that need to be stripped will change. There are several options on what is to be measured such as |Z|, R, L, C for the A display and even more for the B display. Then there are many buttons and features that can be selected. If you don't have one, or at least the manual open, it will be confusing. I wound up with several programs to do different things. I have the HPIB Interface instructions from the manual (pages 3-68 to 3-77 in mine) beside me to refer to the tables. I added a buffer flush because I found that repeated runs kept adding to the buffer from the previous run. Each different run needed some tweeking of the program.. A general interactive program may be possible but not practical. I will add comments before lines that may need to be changed. I would like to hear offline from anyone with a 4192A or 4193A so we can try things together and compare notes. PeterB
toggle quoted message
Show quoted text
On Wed, Feb 6, 2019 at 11:34 AM Harvey White < madyn@...> wrote: On Tue, 5 Feb 2019 11:30:50 -0500, you wrote:
>Thanks Harvey;
>
>I was hoping for a simple answer such as:
>
>Sname:=EZGPIB_ConvertStripToNumber(Sname,Sname,Sname); // where Sname is
>the string
You could write it, but you'd have to do that.
>
>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¡±
That's what you want.
what:string says that the first argument we call it what here, is a
string.? It could also be 'this is a string', for constant strings.
FromWhere is also a string, but it can't be in quotes, since it gets
modified.
Note that this function has two, and only two arguments.? You can't
just pack more arguments onto the thing, it won't work.
>
>
>
>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.
>
EZGPIB_ConvertRemove('NZFN', Answer);? ? ? ? ? ? ? ? // Answer is the
string
That's actually exactly what you should do.
You could also do:
somestring:? ? ? ? ? ? ?string;
somestring := 'NZFN';
EZGPIB_ConvertRemove(somestring, Answer);? ? ? ? ? ? ? ? // Answer is
the string
That works, too.
The advantage to this last one is that you could have a list of things
you wanted to remove (a list of strings), and just substitute that
each time.
If that doesn't make sense, just think that it's sometimes easier to
carry apples in a bag rather than one at a time....? Either, however,
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.
Yep, and the only reason that it gets done (properly done) is if
there's a reason why those three lines need to be tweaked into
something universal...
>
>
>
>So the following works
>
>
>
>EZGPIB_ConvertRemove('NZFN', Answer);? ? ? ? ? ? ? ? // Answer is the string
>
>EZGPIB_ConvertRemove('NTDN', Answer);
>
>EZGPIB_ConvertRemove('K', Answer);
>
There's the solution.
>
>
>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
>
And it doesn't work because EZGPIB_ConvertRemove() takes two and only
two arguments.? You don't get around that.
It's possible to write your own pascal function that does that, but
the best syntax would be something like:
EZGPIB_ConvertRemove_ALL('NZFN', 'NTDN', 'K', Answer);? // will work,
but you have to write it
The procedure would be something like:
procedure EZGPIB_ConvertRemove_ALL(s1: string; s2: string; s3 string;
var string answer);
begin
? ? ? ? EZGPIB_ConvertRemove('NZFN',? Answer);
? ? ? ? EZGPIB_ConvertRemove('NTDN',? Answer);
? ? ? ? EZGPIB_ConvertRemove('K', Answer);
end;
which effectively does pretty much what you do in the three calls.
easier to stick with what you have.
>
>
>Attempts at variations gave compile errors like ¡°too many variables¡±
>
and now you know why.....
>
>
>My complete program is not very elegant but is easy to understand and
>modify, and it works.
About the only thing you might want to do is to modify it slightly to
have a procedure to call to strip the answer, or perhaps send
command/get answer/strip unwanted and save.
That comes when you start to add things, and want a slightly different
program structure that's a bit less spread out.
What you have is done just fine, though.?
>
>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.
Generally, as in the string example, a variable of the right type can
be passed as an argument, that's just plain pascal, not EZGPIB.
However, (skipping the technical explanation for now), you can either
pass a copy to a routine (routine can change it all it wants, but the
original in the calling routine stays intact); or you can pass it a
reference to the original value, in which case, the routine changes
the original.
Reason for saying that is that the routine has to be written to do
that for you, and you can't just expect it to change stuff when
convenient.? (in the little example I did above, the word "var" tells
the program to behave like that.
Perhaps this helps a bit on the passing variables to an EZGPIB
function.
If you want, we can take this offline, simply because it's starting to
deviate from EZGPIB on an HP instrument to general programming.
Harvey
>
>
>
>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:
>>
>> What happens if you run the strip program, then copy the result string
>> from the beginning up to the comma?? In pascal, you can find the
>> location of the comma, and delete all the characters before it.? This
>> ought to give you the second part of the string, which you can strip
>> off the beginning.
>>
>> This uses standard pascal functions.
>>
>> Of course, if you could read one thing at a time (NZFN, then NTDN,
>> etc), you could convert each item individually.
>>
>> Another option would be to search the string for NZFN, then replace it
>> by spaces, ditto for NTDN, etc.
>>
>>
>> maybe easier to copy out to substrings.
>>
>> C has a token function that automatically parses things like this, and
>> pascal doesn't (that I know of).
>>
>> You may want to look for parsing programs, just for fun
>>
>> depends on how involved you want to get with the programming.
>>
>> Harvey
>>
>>
>>
>> >I am looking for help from someone experienced with EZGPIB, or possibly
>> Pascal if any of this makes sense. I wrote a program in EZGPIB that is
>> working well to get data from my HP4192A. Each read of data is in the
>> following format which is added to a buffer and, at the end of the program,
>> stored in a file. I think the reads are tab separated but that is not the
>> problem. NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000 To remove unwanted
>> characters (NZFN = |Z|, NTDN = Phase, K = kHz) I
>> used Answer:=EZGPIB_ConvertStripToNumber(Answer); // an EZGPIB function.
>> Answer is a string variable This only strips the first characters so I
>> get +017.78E+03,NTDN-005.38E+00,K+01.000000 I think the comma terminates
>> the string as far as the function is concerned. I don¡¯t know how to make
>> the function remove all unwanted characters. Does anyone know? I tried a
>> different function three times to remove all characters. It works however I
>> should be able to use it once with the proper formatting to do the job but
>> >I don¡¯t know how. Any suggestions? EZGPIB_ConvertRemove('NZFN', Answer);
>> EZGPIB_ConvertRemove('NTDN', Answer); EZGPIB_ConvertRemove('K',
>> Answer); The result is what I am after: +017.78E+03,-005.38E+00,+01.000000
>> >
>> >
>>
>>
>>
>>
>>
>
>
|
On Tue, 5 Feb 2019 11:30:50 -0500, you wrote: Thanks Harvey;
I was hoping for a simple answer such as:
Sname:=EZGPIB_ConvertStripToNumber(Sname,Sname,Sname); // where Sname is the string You could write it, but you'd have to do that. 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¡±
That's what you want. what:string says that the first argument we call it what here, is a string. It could also be 'this is a string', for constant strings. FromWhere is also a string, but it can't be in quotes, since it gets modified. Note that this function has two, and only two arguments. You can't just pack more arguments onto the thing, it won't work.
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.
EZGPIB_ConvertRemove('NZFN', Answer); // Answer is the string That's actually exactly what you should do. You could also do: somestring: string; somestring := 'NZFN'; EZGPIB_ConvertRemove(somestring, Answer); // Answer is the string That works, too. The advantage to this last one is that you could have a list of things you wanted to remove (a list of strings), and just substitute that each time. If that doesn't make sense, just think that it's sometimes easier to carry apples in a bag rather than one at a time.... Either, however, 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.
Yep, and the only reason that it gets done (properly done) is if there's a reason why those three lines need to be tweaked into something universal...
So the following works
EZGPIB_ConvertRemove('NZFN', Answer); // Answer is the string
EZGPIB_ConvertRemove('NTDN', Answer);
EZGPIB_ConvertRemove('K', Answer);
There's the solution.
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
And it doesn't work because EZGPIB_ConvertRemove() takes two and only two arguments. You don't get around that. It's possible to write your own pascal function that does that, but the best syntax would be something like: EZGPIB_ConvertRemove_ALL('NZFN', 'NTDN', 'K', Answer); // will work, but you have to write it The procedure would be something like: procedure EZGPIB_ConvertRemove_ALL(s1: string; s2: string; s3 string; var string answer); begin EZGPIB_ConvertRemove('NZFN', Answer); EZGPIB_ConvertRemove('NTDN', Answer); EZGPIB_ConvertRemove('K', Answer); end; which effectively does pretty much what you do in the three calls. easier to stick with what you have.
Attempts at variations gave compile errors like ¡°too many variables¡±
and now you know why.....
My complete program is not very elegant but is easy to understand and modify, and it works.
About the only thing you might want to do is to modify it slightly to have a procedure to call to strip the answer, or perhaps send command/get answer/strip unwanted and save. That comes when you start to add things, and want a slightly different program structure that's a bit less spread out. What you have is done just fine, though. 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.
Generally, as in the string example, a variable of the right type can be passed as an argument, that's just plain pascal, not EZGPIB. However, (skipping the technical explanation for now), you can either pass a copy to a routine (routine can change it all it wants, but the original in the calling routine stays intact); or you can pass it a reference to the original value, in which case, the routine changes the original. Reason for saying that is that the routine has to be written to do that for you, and you can't just expect it to change stuff when convenient. (in the little example I did above, the word "var" tells the program to behave like that. Perhaps this helps a bit on the passing variables to an EZGPIB function. If you want, we can take this offline, simply because it's starting to deviate from EZGPIB on an HP instrument to general programming. Harvey
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:
What happens if you run the strip program, then copy the result string from the beginning up to the comma? In pascal, you can find the location of the comma, and delete all the characters before it. This ought to give you the second part of the string, which you can strip off the beginning.
This uses standard pascal functions.
Of course, if you could read one thing at a time (NZFN, then NTDN, etc), you could convert each item individually.
Another option would be to search the string for NZFN, then replace it by spaces, ditto for NTDN, etc.
maybe easier to copy out to substrings.
C has a token function that automatically parses things like this, and pascal doesn't (that I know of).
You may want to look for parsing programs, just for fun
depends on how involved you want to get with the programming.
Harvey
I am looking for help from someone experienced with EZGPIB, or possibly Pascal if any of this makes sense. I wrote a program in EZGPIB that is working well to get data from my HP4192A. Each read of data is in the following format which is added to a buffer and, at the end of the program, stored in a file. I think the reads are tab separated but that is not the problem. NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000 To remove unwanted characters (NZFN = |Z|, NTDN = Phase, K = kHz) I used Answer:=EZGPIB_ConvertStripToNumber(Answer); // an EZGPIB function. Answer is a string variable This only strips the first characters so I get +017.78E+03,NTDN-005.38E+00,K+01.000000 I think the comma terminates the string as far as the function is concerned. I don¡¯t know how to make the function remove all unwanted characters. Does anyone know? I tried a different function three times to remove all characters. It works however I should be able to use it once with the proper formatting to do the job but
I don¡¯t know how. Any suggestions? EZGPIB_ConvertRemove('NZFN', Answer); EZGPIB_ConvertRemove('NTDN', Answer); EZGPIB_ConvertRemove('K', Answer); The result is what I am after: +017.78E+03,-005.38E+00,+01.000000
|
Wanted: HP 8340 Or HP 8341 Sig Gen non-working Parts unit
hi, I need an HP 8340 Or HP 8341 Sig Gen ? non-working ?parts unit to repair my unit (multiple issues).
A non-working, but complete ?8340 Or 8341 ?would be good.
Please contact me off-list, thank you, rick
|
N connectors are air dielectric coaxial transmission lines where they mate. Impedance for an air dielectric coaxial line is:
Z0 = 60 ln(r0/ri)
So, a 75 ohm center conductor (ri) is necessarily smaller in diameter than a 50 ohm center conductor for a given size shield diameter (r0).
If you mate a 50 ohm male N connector with a 75 ohm female N connector, the usual result is to break one of the leaves of the center conductor on the female connector.
The same does not apply to typical BNC connectors, as the 50 ohm BNC has a teflon dielectric, but the 75 ohm BNC has an air dielectric, so the center conductors are the same diameter.
More than you wanted to know.
-Chuck Harris
peter bunge via Groups.Io wrote:
toggle quoted message
Show quoted text
Hi Steve, an HP8714B just sold for $565 US. I suspect you paid much less for the 75 ohm version and as much for shipping.. My suggestion is to keep it and use it with 75/50 pads to learn about it while watching for a cheap 50 ohm version, not working if you have repair abilities, and use your 75 ohm version to troubleshoot and repair. Do you have the pads? I have a couple of new Greenpar 502-4718-701, 90-48 that you can have for the price of shipping. Contact me offline. Be aware that the 75 ohm Type N are different from the 50 ohm Type N and you could damage them by attaching the wrong one. Someone else may have a better explanation but 75 ohms seems to explain the different dimensions. PeterB [image: 75_50 ohm pads.JPG]
|
Just to note¡
?
¡®90-48¡¯ is most probably the yeardate/week of manufacture code.
?
Nigel
?
toggle quoted message
Show quoted text
From: [email protected] [mailto:[email protected]]
On Behalf Of peter bunge
Sent: 06 February 2019 14:20
To: [email protected]
Subject: Re: [HP-Agilent-Keysight-equipment] HP8714ET Impedance
?
Hi Steve, an HP8714B just sold for $565 US.
I suspect you paid much less for the 75 ohm version and as much for shipping..?
My suggestion is to keep it and use it with 75/50 pads to learn about it while watching for a cheap 50 ohm version, not working if you have repair abilities, and use your 75 ohm version to troubleshoot and repair.
Do you have the pads? I have a couple of new Greenpar 502-4718-701, 90-48 that you can have for the price of shipping. Contact me offline.
Be aware that the 75 ohm Type N are different from the 50 ohm Type N and you could damage them by attaching the wrong one. Someone else may have a better explanation but 75 ohms seems to explain the different dimensions.
?
On Wed, Feb 6, 2019 at 6:54 AM Steve Hendrix <SteveHx@...> wrote:
At 2019-02-05 03:33 PM, pianovt via Groups.Io wrote:
From an cost standpoint, it would only be worth converting to 50 Ohms if you get the parts for free.
Thank you for the confirmation. That's exactly the sort of expert knowledge I was looking for with my question.
For what it's worth, and I suspect you don't want to hear this, I would suggest returning the 75 Ohm analyzer if you can and waiting until you find one that's right.
For now it makes sense to me to keep it, and count the cost as a cost of my own education. I can learn a whole bunch using this unit, and for now at least, it goes well beyond my needs in terms of precision and dynamic range. If I learn enough, I might decide
I need something fancier, but for now it's a tremendous bargain for me.
Use the minimum loss pads. They will work and you will be able to calibrate the analyzer correctly with a 50 Ohm cal kit,
Thank you for that confirmation. I was hoping for such, but couldn't absolutely prove it in my own head. I need to play with the calibration a bit to fully understand what parameters they're actually saving inside.
but you will lose 2 times 5.7dB in sensitivity on transmission and reflection measurements.
Good, at least I'm on the right track. I not only lose 11.4 dB of dynamic range, but I also have a ready-made attenuator so can put an extra 5.7 dB into the transmission port before I blow anything up. Just a bit more protection against my fumble-fingers!
Thank you for the detailed response to my question!
Steve Hendrix
|
Hi Steve, an HP8714B just sold for $565 US. I suspect you paid much less for the 75 ohm version and as much for shipping..? My suggestion is to keep it and use it with 75/50 pads to learn about it while watching for a cheap 50 ohm version, not working if you have repair abilities, and use your 75 ohm version to troubleshoot and repair. Do you have the pads? I have a couple of new Greenpar 502-4718-701, 90-48 that you can have for the price of shipping. Contact me offline. Be aware that the 75 ohm Type N are different from the 50 ohm Type N and you could damage them by attaching the wrong one. Someone else may have a better explanation but 75 ohms seems to explain the different dimensions. PeterB
toggle quoted message
Show quoted text
On Wed, Feb 6, 2019 at 6:54 AM Steve Hendrix < SteveHx@...> wrote:
At 2019-02-05 03:33 PM, pianovt via Groups.Io wrote:
From an cost standpoint, it
would only be worth converting to 50 Ohms if you get the parts for
free.
Thank you for the confirmation. That's exactly the sort of expert
knowledge I was looking for with my question.
For what it's
worth, and I suspect you don't want to hear this, I would suggest
returning the 75 Ohm analyzer if you can and waiting until you find one
that's right.
For now it makes sense to me to keep it, and count the cost as a cost of
my own education. I can learn a whole bunch using this unit, and for now
at least, it goes well beyond my needs in terms of precision and dynamic
range. If I learn enough, I might decide I need something fancier, but
for now it's a tremendous bargain for me.
Use the minimum
loss pads. They will work and you will be able to calibrate the analyzer
correctly with a 50 Ohm cal kit,
Thank you for that confirmation. I was hoping for such, but couldn't
absolutely prove it in my own head. I need to play with the calibration a
bit to fully understand what parameters they're actually saving
inside.
but you will lose 2
times 5.7dB in sensitivity on transmission and reflection
measurements.
Good, at least I'm on the right track. I not only lose 11.4 dB of dynamic
range, but I also have a ready-made attenuator so can put an extra 5.7 dB
into the transmission port before I blow anything up. Just a bit more
protection against my fumble-fingers!
Thank you for the detailed response to my question!
Steve Hendrix
|
At 2019-02-05 03:33 PM, pianovt via Groups.Io wrote:
From an cost standpoint, it
would only be worth converting to 50 Ohms if you get the parts for
free.
Thank you for the confirmation. That's exactly the sort of expert
knowledge I was looking for with my question.
For what it's
worth, and I suspect you don't want to hear this, I would suggest
returning the 75 Ohm analyzer if you can and waiting until you find one
that's right.
For now it makes sense to me to keep it, and count the cost as a cost of
my own education. I can learn a whole bunch using this unit, and for now
at least, it goes well beyond my needs in terms of precision and dynamic
range. If I learn enough, I might decide I need something fancier, but
for now it's a tremendous bargain for me.
Use the minimum
loss pads. They will work and you will be able to calibrate the analyzer
correctly with a 50 Ohm cal kit,
Thank you for that confirmation. I was hoping for such, but couldn't
absolutely prove it in my own head. I need to play with the calibration a
bit to fully understand what parameters they're actually saving
inside.
but you will lose 2
times 5.7dB in sensitivity on transmission and reflection
measurements.
Good, at least I'm on the right track. I not only lose 11.4 dB of dynamic
range, but I also have a ready-made attenuator so can put an extra 5.7 dB
into the transmission port before I blow anything up. Just a bit more
protection against my fumble-fingers!
Thank you for the detailed response to my question!
Steve Hendrix
|
From an cost standpoint, it would only be worth converting to 50 Ohms if you get the parts for free. Here are some pictures of the RF deck in the 75 Ohm design:
The main expense is in the gold plated microcircuit in the front (part number 5086-7937). You would need to find the equivalent part for a 50 Ohm analyzer and that will probably cost more than it's worth. There are other expensive parts too, e.g. the two Type N connectors and possibly the coax cables inside.
For what it's worth, and I suspect you don't want to hear this, I would suggest returning the 75 Ohm analyzer if you can and waiting until you find one that's right. Even if you get a partial refund, you will probably be happier in the end. If not, use the minimum loss pads. They will work and you will be able to calibrate the analyzer correctly with a 50 Ohm cal kit, but you will lose 2 times 5.7dB in sensitivity on transmission and reflection measurements.
Vladan
|
I don't know how the commas were changed to periods. The program is not elegant but works and should be useful without knowing anything about Pascal. I am going to leave it alone. This is a typical output file: ?+017.78E+03,-005.38E+00,+01.000000 +017.21E+03,-010.13E+00,+02.000000 +016.44E+03,-014.11E+00,+03.000000 +015.59E+03,-017.17E+00,+04.000000 +014.76E+03,-019.37E+00,+05.000000 +014.01E+03,-020.88E+00,+06.000000 +013.35E+03,-021.85E+00,+07.000000 +012.79E+03,-022.43E+00,+08.000000 +012.31E+03,-022.76E+00,+09.000000 +011.91E+03,-022.90E+00,+010.00000 +09.962E+03,-022.53E+00,+020.00000 +09.237E+03,-023.53E+00,+030.00000 +08.734E+03,-025.50E+00,+040.00000 +08.285E+03,-027.72E+00,+050.00000 +07.863E+03,-029.86E+00,+060.00000 +07.462E+03,-031.77E+00,+070.00000 +07.087E+03,-033.40E+00,+080.00000 +06.740E+03,-034.79E+00,+090.00000 +06.420E+03,-035.93E+00,+0100.0000 +04.441E+03,-039.26E+00,+0200.0000 +03.588E+03,-037.83E+00,+0300.0000 +03.127E+03,-035.84E+00,+0400.0000 +02.837E+03,-033.95E+00,+0500.0000 +02.636E+03,-032.24E+00,+0600.0000 +02.487E+03,-030.71E+00,+0700.0000 +02.372E+03,-029.33E+00,+0800.0000 +02.281E+03,-028.08E+00,+0900.0000 +02.207E+03,-026.93E+00,+01000.000
toggle quoted message
Show quoted text
On Tue, Feb 5, 2019 at 12:27 PM peter bunge via Groups.Io <bunge.pjp= [email protected]> wrote: Thanks Reg; this was exactly the sort of suggestion I was looking for. It needs a closing bracket to compile? ? ? EZGPIB_ConvertRemove('(NZFN|NTDN|K)',Answer); However it does not remove any items. This is a sample from the file generated:
NZFN+011.92E+03,NTDN-022.92E+00,K+010.00000 NZFN+09.968E+03,NTDN-022.57E+00,K+020.00000 NZFN+09.241E+03,NTDN-023.56E+00,K+030.00000 // note comma separated
etc.
This is a sample using? ?? Answer:=EZGPIB_ConvertStripToNumber(Answer);? ? ? ?// strip off all ID
+017.78E+03.NTDN-005.38E+00.K+01.000000? ? // note period separated, this could cause problems
This is a sample from the file when I use the three separate lines.? ? ??EZGPIB_ConvertRemove('NZFN', Answer); It is strange that it changes from commas separated to period separated. I suspect that I am not using proper syntax.
+017.79E+03.-005.40E+00.+01.000000 +017.23E+03.-010.15E+00.+02.000000 +016.45E+03.-014.13E+00.+03.000000 +015.60E+03.-017.19E+00.+04.000000
On Tue, Feb 5, 2019 at 10:42 AM Reginald Beardsley via Groups.Io <pulaskite= [email protected]> wrote: It's very common in string processing libraries to only replace the first instance unless a flag is passed.? All the traditional Unix tools work that way as best I can recall.? Does the EZGPIB documentation say anything about it?
As a wild guess, try this *exactly* as typed:
EZGPIB_ConvertRemove('(NZFN|NTDN|K)',Answer ;
This is standard regular expression syntax and if the authors of EZGPIB had any sense they used one.? Henry Spencer's was always held in high regard, but there are a lot to choose from.? Very likely if you add a 3rd string between the current two it will replace the first string with the 2nd string in sed(1) style.
FWIW Almost all the processing you might want to do is trivial using awk and gnuplot.
|
Look in the service manual. It depends on the instrument. I remember looking at an HP 'scope that had 75¦¸ input long ago and it was the same as the 50¦¸ version but with an internal minimum loss pad that could easily be removed and have the N connector on the front panel replaced with a 50¦¸ version. Other things, like the 8753 test sets require a complete replacement of the samplers, which can easily cost more than the analyzer.
toggle quoted message
Show quoted text
On Tue, Feb 5, 2019 at 6:55 PM Steve Hendrix < SteveHx@...> wrote:
A fellow engineer raised a question re the 75 ohm
characteristic impedance of the HP8714ET I just purchased off eBay.
Although I have minimum-loss matching pads ordered and enroute, does
anyone here know just what would be involved if I were to open up the
unit and try to change the impedance with some part swaps? The firmware
already supports a choice of 75 ohm or 50 ohms as the impedance, for
Smith charts, etc. I suspect that before I do that, I had better get the
service manuals, but that's for the future - thus far I'm less than 1/4
of the way thru reading the user manual, and I have a bunch of other
documentation to read as well. I'm very pleased with my purchase, if only
for the education I'm getting!
Steve Hendrix
|
New 141T Spectrum Analyzer CRT available + Stuff Day
While getting things ready for Stuff Day (April 13th), I found a new factory boxed 5083-2511 storage CRT tucked away in the back room. If anybody has a 141T with a poor CRT that needs love and attention, this can do the trick. I used to have two 141T systems, so was always looking for spares, thus this tube. Now I have two 70K SA systems instead, and no need for the tube. Please email me off list if interested at walter2 -at- sphere.bc.ca? Still a few of those snap in black HP feet left too.
We will have lots of Tek, Philips (fluke), generic and HP CRTs at the upcoming stuff day event, and all will be dirt cheap, so come visit if you can, we need the space!? all the event details are here:?https://www.sphere.bc.ca/test/stuffday.html
there is a lot of one of a kind HP and Tek spare stuff we never have time to post on line, so a visit on stuff day reveals many surprises and goodies you will never see otherwise.? plus, Kelowna is a great place to visit.
all the best, walter sphere research corp. https://www.sphere.bc.ca
|
A fellow engineer raised a question re the 75 ohm
characteristic impedance of the HP8714ET I just purchased off eBay.
Although I have minimum-loss matching pads ordered and enroute, does
anyone here know just what would be involved if I were to open up the
unit and try to change the impedance with some part swaps? The firmware
already supports a choice of 75 ohm or 50 ohms as the impedance, for
Smith charts, etc. I suspect that before I do that, I had better get the
service manuals, but that's for the future - thus far I'm less than 1/4
of the way thru reading the user manual, and I have a bunch of other
documentation to read as well. I'm very pleased with my purchase, if only
for the education I'm getting!
Steve Hendrix
|
On Tue, 5 Feb 2019 09:57:45 +0000, you wrote: If you need to parse and filter strings, Pascal is way and above much easier than C to use.?? C++ is different again. For the ST Micro, using TrueStudio, I use tokenptr = strtok((char*)&WIFI.RXbuffer.data[j],delimiters); strcpy(token[i],tokenptr); for a snippet of code. In pascal (first Delphi, then Lazarus), I had to write my own. What did I miss here in Pascal (just curious, already got a parser and so on done....)? Feel free to reply off list. Harvey As EZGPIB is Pascal based, best look up the string handling scheme on the web.? There are LOADS of tutorials out there to show you how it's done.
It's common to need to either top/n/tail a string before conversion to a numeric value, and there are just too many ways to do that, to list here.
As EZGPIB is in essence an interpreter, you can play with it live, with test strings, no need to have it hooked to any hardware...
Cheers.
Dave G0WBX.
|
Thanks Reg; this was exactly the sort of suggestion I was looking for. It needs a closing bracket to compile? ? ? EZGPIB_ConvertRemove('(NZFN|NTDN|K)',Answer); However it does not remove any items. This is a sample from the file generated:
NZFN+011.92E+03,NTDN-022.92E+00,K+010.00000 NZFN+09.968E+03,NTDN-022.57E+00,K+020.00000 NZFN+09.241E+03,NTDN-023.56E+00,K+030.00000 // note comma separated
etc.
This is a sample using? ?? Answer:=EZGPIB_ConvertStripToNumber(Answer);? ? ? ?// strip off all ID
+017.78E+03.NTDN-005.38E+00.K+01.000000? ? // note period separated, this could cause problems
This is a sample from the file when I use the three separate lines.? ? ??EZGPIB_ConvertRemove('NZFN', Answer); It is strange that it changes from commas separated to period separated. I suspect that I am not using proper syntax.
+017.79E+03.-005.40E+00.+01.000000 +017.23E+03.-010.15E+00.+02.000000 +016.45E+03.-014.13E+00.+03.000000 +015.60E+03.-017.19E+00.+04.000000
toggle quoted message
Show quoted text
On Tue, Feb 5, 2019 at 10:42 AM Reginald Beardsley via Groups.Io <pulaskite= [email protected]> wrote: It's very common in string processing libraries to only replace the first instance unless a flag is passed.? All the traditional Unix tools work that way as best I can recall.? Does the EZGPIB documentation say anything about it?
As a wild guess, try this *exactly* as typed:
EZGPIB_ConvertRemove('(NZFN|NTDN|K)',Answer ;
This is standard regular expression syntax and if the authors of EZGPIB had any sense they used one.? Henry Spencer's was always held in high regard, but there are a lot to choose from.? Very likely if you add a 3rd string between the current two it will replace the first string with the 2nd string in sed(1) style.
FWIW Almost all the processing you might want to do is trivial using awk and gnuplot.
|
Re: HP8595E adding tracking generator
On 1/23/19 1:43 PM, Steve Hendrix wrote: ? I don't use any of my VNAs very often, but when I do, they're indispensable.? I don't know where you're based, but if you're anywhere near Pittsburgh, you're certainly welcome to use mine if the need arises...I have a lot of presets and calibration frequency range subsets for those two ISM bands in particular. ;) Not all that far...I once made a day trip over there to do my own investigation of relatives that Children Services was contemplating placing our foster baby with. I'm about halfway between Akron and Cleveland, right off I-80 at SR 8.
Wow, this half-typed reply has been sitting there buried under another window for two weeks. Sorry about that. But yes, not far at all. You're welcome any time. And I can take you on a tour of the museum as well, if you're interested. And don't bother with any of that football rivalry stuff! Ah, no. Watching grown men chase a ball is not within my spectrum of pursuits. I'm curious what model VNAs you have found to be most useful. My test equipment runs toward the oldie and goodie types, not the latest-and-greatest whiz-bang gadgets. I like HP gear, except for that standing for High Priced. My instruments aren't very new, but I know how to run them and I know how to avoid having them fib to me (mostly). Looking around my test bench, the only ones I see that I actually bought new are the TDS220 scope with the full FFT and communications packages, and an MPJA power supply. Just about everything else is HP (not Agilent nor Keysight) gear that I've scrounged on eBay etc. I'm a one-man shop, originally mostly embedded firmware, migrating over the years to digital hardware, then analog hardware, then RF. I've had to learn as I go and pick up equipment as I go. My strong suits are 1) Asking stupid questions 2) Mixing firmware and hardware for an optimum solution, and 3) Being able to work anywhere across the firmware / hardware fence, and at extremes. Recent projects have ranged from fA to hundreds of A, nV to KV, DC to GHz, fF to F, etc. It sounds as though we are cut from the same cloth. ;) My emphasis is on performance and trustworthiness; no other considerations really get much attention. I'm not a rich man, but even pricing doesn't bother me much, as one can always find a deal if one looks in the right place. I can put pretty much anything in my lab these days...I strive to get the very best instrument(s) to perform a given function, regardless of age. This is how I feed myself and my family, so being able to count on my tools is important to me. The VNA I use is a well-appointed HP 8510C. I started to "upgrade" it to an 8753 series machine (because newer is always better, right?), but the user interface on those is complete ass and they're nowhere near as flexible as an 8510 system. I'm still watching for a good buy on a VNA that will go to 3 GHz, preferably 6 GHz. One got away yesterday when it went from $150 to $2000 in the last 30 seconds of the auction. Ah well, my time will come! I think I saw that you picked one up. Too bad it's a 75-ohm unit. :-( But you should be able to just use minimum-loss pads and extend the reference plane out past them during calibration. I've not done that (I have no 75-ohm gear) but I see no reason why it wouldn't work. P.S. Oops! I meant this to be offline, not to the whole group. I thought there was a way to do a private reply.?!? There is if you don't bother with the web forum garbage and use it as a mailing list! ;) -Dave -- Dave McGuire, AK4HZ New Kensington, PA
|
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.
toggle quoted message
Show quoted text
On Tue, Feb 5, 2019 at 12:20 AM Harvey White < madyn@...> wrote: On Mon, 04 Feb 2019 15:36:34 -0800, you wrote:
What happens if you run the strip program, then copy the result string
from the beginning up to the comma?? In pascal, you can find the
location of the comma, and delete all the characters before it.? This
ought to give you the second part of the string, which you can strip
off the beginning.
This uses standard pascal functions.
Of course, if you could read one thing at a time (NZFN, then NTDN,
etc), you could convert each item individually.
Another option would be to search the string for NZFN, then replace it
by spaces, ditto for NTDN, etc.
maybe easier to copy out to substrings.
C has a token function that automatically parses things like this, and
pascal doesn't (that I know of).
You may want to look for parsing programs, just for fun
depends on how involved you want to get with the programming.
Harvey
>I am looking for help from someone experienced with EZGPIB, or possibly Pascal if any of this makes sense. I wrote a program in EZGPIB that is working well to get data from my HP4192A.?Each read of data is in the following format which is added to a buffer and, at the end of the program, stored in a file. I think the reads are tab separated but that is not the problem.?NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000?To remove unwanted characters (NZFN = |Z|, NTDN = Phase, K = kHz) I used?Answer:=EZGPIB_ConvertStripToNumber(Answer);?// an EZGPIB function. Answer is a string variable?This only strips the first characters so I get?+017.78E+03,NTDN-005.38E+00,K+01.000000?I think the comma terminates the string as far as the function is concerned. I don¡¯t know how to make the function remove all unwanted characters. Does anyone know? I tried a different function three times to remove all characters. It works however I should be able to use it once with the proper formatting to do the job but
>I don¡¯t know how. Any suggestions??EZGPIB_ConvertRemove('NZFN', Answer); EZGPIB_ConvertRemove('NTDN', Answer); EZGPIB_ConvertRemove('K', Answer);?The result is what I am after: +017.78E+03,-005.38E+00,+01.000000
>
>
|
It's very common in string processing libraries to only replace the first instance unless a flag is passed. All the traditional Unix tools work that way as best I can recall. Does the EZGPIB documentation say anything about it?
As a wild guess, try this *exactly* as typed:
EZGPIB_ConvertRemove('(NZFN|NTDN|K)',Answer ;
This is standard regular expression syntax and if the authors of EZGPIB had any sense they used one. Henry Spencer's was always held in high regard, but there are a lot to choose from. Very likely if you add a 3rd string between the current two it will replace the first string with the 2nd string in sed(1) style.
FWIW Almost all the processing you might want to do is trivial using awk and gnuplot.
|
Sadly, I cannot help - but I am interested in an answer to this as I will probably need to do much the same in the near future.
David
On 04/02/2019 23:36, peter bunge wrote:
toggle quoted message
Show quoted text
I am looking for help from someone experienced with EZGPIB, or possibly Pascal if any of this makes sense.
I wrote a program in EZGPIB that is working well to get data from my HP4192A.
?
Each read of data is in the following format which is added to a buffer and, at the end of the program, stored in a file. I think the reads are tab separated but that is not the problem.
?NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000
?To remove unwanted characters (NZFN = |Z|, NTDN = Phase, K = kHz) I used
?Answer:=EZGPIB_ConvertStripToNumber(Answer);?
// an EZGPIB function. Answer is a string variable
?This only strips the first characters so I get
?+017.78E+03,NTDN-005.38E+00,K+01.000000
?I think the comma terminates the string as far as the function is concerned. I don¡¯t know how to make the function remove all unwanted characters. Does anyone know?
I tried a different function three times to remove all characters. It works however I should be able to use it once with the proper formatting to do the job but I don¡¯t know how. Any suggestions?
?EZGPIB_ConvertRemove('NZFN', Answer);
EZGPIB_ConvertRemove('NTDN', Answer);
EZGPIB_ConvertRemove('K', Answer);
?The result is what I am after:
+017.78E+03,-005.38E+00,+01.000000
|
Peter.
Try
this worked example.
Program
Trial3;??
Procedure
ShowError();
begin?
// show an exeption message
??
EZGPIB_ScreenWriteln('A "' + ExceptionToString(ExceptionType,
ExceptionParam) + '" Error occured!');
end;
// Find
and remove, a substring within a string.
Function
Remove(SubStr:string; BodyStr:string):String;
Var
SubPos, SubLen: LongInt;
Begin
?????
SubPos := Pos(SubStr, BodyStr);
?????
SubLen := Length(SubStr);
?????
Delete(BodyStr, SubPos, SubLen);
?????
result := BodyStr;
end;???
//
Variables.
Var
DatainStr: String;
?
Begin
??
EZGPIB_ScreenClear;? // wipe the console clean
??
DataInStr := 'NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000'??
// Test Data
?? try? //
run this block of code
?????
EZGPIB_ScreenWriteln(DataInStr);
??? ?
DataInStr := Remove('NZFN', DataInStr);
?????
DataInStr := Remove('NTDN', DataInStr);
?????
DataInStr := Remove('K', DataInStr);
????????
?????
EZGPIB_ScreenWriteln(DataInStr);
??
except? // if(when) the above block causes an error, then..
?????
ShowError;
?? end;
End.
?
The
Function ¡°Remove¡± uses EZGPIB¡¯s general Procedure ¡°Delete¡±.
Try
it.?? It seems safe in the event that the substring is not
found too.
?
Subject:
Help with EZGPIB
From: peter bunge
Date: Mon, 04 Feb 2019 15:36:34 PST
I am looking for help from someone
experienced with EZGPIB, or possibly Pascal if any of this
makes sense.
I wrote a program in EZGPIB that is
working well to get data from my HP4192A.
?
Each read of data is in the
following format which is added to a buffer and, at the end
of the program, stored in a file. I think the reads are tab
separated but that is not the problem.
?NZFN+017.78E+03,NTDN-005.38E+00,K+01.000000
?To remove unwanted characters
(NZFN = |Z|, NTDN = Phase, K = kHz) I used
?Answer:=EZGPIB_ConvertStripToNumber(Answer);? // an EZGPIB
function. Answer is a string variable
?This only strips the first
characters so I get
?+017.78E+03,NTDN-005.38E+00,K+01.000000
?I think the comma terminates the
string as far as the function is concerned. I don¡¯t know how
to make the function remove all unwanted characters. Does
anyone know?
I tried a different function three
times to remove all characters. It works however I should be
able to use it once with the proper formatting to do the job
but I don¡¯t know how. Any suggestions?
?EZGPIB_ConvertRemove('NZFN',
Answer);
EZGPIB_ConvertRemove('NTDN',
Answer);
EZGPIB_ConvertRemove('K', Answer);
?The result is what I am after:
+017.78E+03,-005.38E+00,+01.000000
--
Created on and sent from a Unix like PC running and using free and open source software.
::
|
Re: HP 3314A - experience
On Feb 5, 2019, at 08:43, Tobias Pluess <tobias.pluess@...> wrote: I also managed to get a (very ugly PDF scan) service manual.
Maybe less ugly: (Says for 2141A and greater) Gr¨¹?e, Carsten
|