Convert hp basic code to visual basic code
Author |
Message |
Stagem #1 / 7
|
 Convert hp basic code to visual basic code
Hi all, Can somebody convert this hp basic code to Visual Basic code for me? Here is the hp basic code:
4. Float = Length DIV 8 5. REDIM Meetwdsa(1:Float), Meetw(1:Float-66)
9. ... Dsa = hp 3562A digital signal analyser Most code is allready converted to visual basic, the lines 6, 7 and 8 not. So if you only know how to do that please tell me. Thanks for your help and advice! Greetz, Stageman
|
Tue, 17 Aug 2004 22:06:57 GMT |
|
 |
Duane Bozart #2 / 7
|
 Convert hp basic code to visual basic code
Quote:
> Hi all, > Can somebody convert this hp basic code to visual basic code for me? > Here is the hp basic code:
> 4. Float = Length DIV 8 > 5. REDIM Meetwdsa(1:Float), Meetw(1:Float-66)
> 9. ... > Dsa = hp 3562A digital signal analyser > Most code is allready converted to visual basic, the lines 6, 7 and 8 not. > So if you only know how to do that please tell me. > Thanks for your help and advice!
Oh, gosh, it's been sooooo long since I last did HP Basic--about 20 years as near as I can recollect. I guess I should take that as a sign I'm getting to approach codger-ville :-) Anyway, best I recall, FORMAT OFF stopped CRLF and ASCII formatting. That makes sense in the context you give of then downloading a data array to the analyzer. In VB, open the channel for BINARY and you should be ok (I think, but please don't be too harsh on me if I've forgotten and gotten it wrong <g>). I've also forgotten the architecture--is this a serial or HPIB interface? Although typically I recall the HPIB controller was channel "7" (although there could, of course, be multiple controllers and the one could be reassigned from the default location). HTH...I don't think I'd be able to put my hands on any HP docs anymore as I gave the old HP 85B away when I moved last time--although I've regretted it occasionally just for the nostalgia of it all....
|
Wed, 18 Aug 2004 02:59:46 GMT |
|
 |
Mike Scirocc #3 / 7
|
 Convert hp basic code to visual basic code
I think you'd have to write drivers for all of the instruments you wanted to talk to, not an easy task. That was one of the strong points of HP VEE, and even it has problems sometimes. Quote:
> > Hi all, > > Can somebody convert this hp basic code to visual basic code for me? > > Here is the hp basic code:
> > 4. Float = Length DIV 8 > > 5. REDIM Meetwdsa(1:Float), Meetw(1:Float-66)
> > 9. ... > > Dsa = hp 3562A digital signal analyser > > Most code is allready converted to visual basic, the lines 6, 7 and 8 not. > > So if you only know how to do that please tell me. > > Thanks for your help and advice! > Oh, gosh, it's been sooooo long since I last did HP Basic--about 20 > years as near as I can recollect. I guess I should take that as a sign > I'm getting to approach codger-ville :-) > Anyway, best I recall, FORMAT OFF stopped CRLF and ASCII formatting. > That makes sense in the context you give of then downloading a data > array to the analyzer. In VB, open the channel for BINARY and you > should be ok (I think, but please don't be too harsh on me if I've > forgotten and gotten it wrong <g>). > I've also forgotten the architecture--is this a serial or HPIB > interface? Although typically I recall the HPIB controller was channel > "7" (although there could, of course, be multiple controllers and the > one could be reassigned from the default location). > HTH...I don't think I'd be able to put my hands on any HP docs anymore > as I gave the old HP 85B away when I moved last time--although I've > regretted it occasionally just for the nostalgia of it all....
|
Wed, 18 Aug 2004 04:37:29 GMT |
|
 |
Duane Bozart #4 / 7
|
 Convert hp basic code to visual basic code
Well, that's why I asked about the serial device...if it is GPIB he's (obviously) got to use a GPIB interface. But if he's got one of them he's got the docs for it and shouldn't be on this mission. On the other hand, if it's serial there's <maybe> a chance. I figured (perhaps overly optimistically) he had tried the most simple thing to see if he could interact directly before doing anything further, but that may have been <too> optimistic..... Another alternative besides HP VEE is the Kiethley package--oh, pooh!--now what was that called? Doggone, it, I can't retrieve it just now, but I liked it better than VEE although it is pricey and has a silly key with it. And, of course, there's all the NI stuff although for something that appears as simple as the code provided a plain GPIB board and the VB drivers will surely suffice rather than labview... Quote:
> I think you'd have to write drivers for all of the instruments you > wanted to talk to, not an easy task. That was one of the strong > points of HP VEE, and even it has problems sometimes.
> > > Hi all, > > > Can somebody convert this hp basic code to visual basic code for me? > > > Here is the hp basic code:
> > > 4. Float = Length DIV 8 > > > 5. REDIM Meetwdsa(1:Float), Meetw(1:Float-66)
> > > 9. ... > > > Dsa = hp 3562A digital signal analyser > > > Most code is allready converted to visual basic, the lines 6, 7 and 8 not. > > > So if you only know how to do that please tell me. > > > Thanks for your help and advice! > > Oh, gosh, it's been sooooo long since I last did HP Basic--about 20 > > years as near as I can recollect. I guess I should take that as a sign > > I'm getting to approach codger-ville :-) > > Anyway, best I recall, FORMAT OFF stopped CRLF and ASCII formatting. > > That makes sense in the context you give of then downloading a data > > array to the analyzer. In VB, open the channel for BINARY and you > > should be ok (I think, but please don't be too harsh on me if I've > > forgotten and gotten it wrong <g>). > > I've also forgotten the architecture--is this a serial or HPIB > > interface? Although typically I recall the HPIB controller was channel > > "7" (although there could, of course, be multiple controllers and the > > one could be reassigned from the default location). > > HTH...I don't think I'd be able to put my hands on any HP docs anymore > > as I gave the old HP 85B away when I moved last time--although I've > > regretted it occasionally just for the nostalgia of it all....
|
Wed, 18 Aug 2004 05:21:33 GMT |
|
 |
Stagem #5 / 7
|
 Convert hp basic code to visual basic code
Here is some more information: I am using an GPIB card from National Instrument. I have the drivers. I can send DSA commands to the DSA. I can not read data from the DSA. When I write the array on the screen (hp basic) then I see numbers like this: -1.003445 and 0.342344 so this I have to do with real numbers. Is that important to know? If there are some other this that you want to know, just ask me. Thanks, Stageman
|
Thu, 19 Aug 2004 07:42:27 GMT |
|
 |
Duane Bozart #6 / 7
|
 Convert hp basic code to visual basic code
Quote:
> Here is some more information: > I am using an GPIB card from National Instrument. > I have the drivers. > I can send DSA commands to the DSA. > I can not read data from the DSA. > When I write the array on the screen (hp basic) then I see numbers > like this: -1.003445 and 0.342344 so this I have to do with real numbers. > Is that important to know?
Well, with HPIB, <everything> is important to know!!!! <G> And, unfortunately, my experience with NI software has not been stellar, but the simple GPIB card <should> be ok. The biggest problem I've had over the years w/GPIB instruments and non-HPIB controllers is the propensity of the instrument to simply fail to reset and subsequently "lock up" tight for further software control--but would almost never be a problem with genuine HP. I don't know the reason, just my experience--YMMV. Anyway, I can't really tell w/o the docs for the particular instrument exactly what form of output the instrument is expecting for a given command. And w/o any of my old HP controller docs, I can't refer to the actual HP Basic code to do more than just dredge up old recollections that are not trustworthy. So, the upshot is, from memory I can't help much more w/o some additional tools that are not directly available to me here. If you can describe the command set succintly (and accurately) for the analyzer that you want to implement, I can probably tell you how to format the data to get it downloaded. I think you can <not> assume from the output to the screen from the HP routine that the data transmission to/from the instrument is ASCII--it <could> be, but is more likely just being formatted by the display statement. But, most HP instruments I've used (and I've done several signal analyzers, just not the particular model you have) have the option for either ASCII or binary data--it's usually much faster to use binary for the spectra or time history values. The kicker is that some of the instruments have special formats for the numeric storage that must be considered--some are simple 8 or 16 bit twos-complement integers (maybe w/block scaling), some are floating point, some are special formats unique to the given instrument. So, I can't tell for sure w/o more info. Sorry I can't be more definitive. Quote: > If there are some other this that you want to know, just ask me. > Thanks, > Stageman
|
Thu, 19 Aug 2004 23:31:43 GMT |
|
 |
Norm Man #7 / 7
|
 Convert hp basic code to visual basic code
Quote: > Can somebody convert this hp basic code to visual basic code for me? > Here is the hp basic code:
> 4. Float = Length DIV 8 > 5. REDIM Meetwdsa(1:Float), Meetw(1:Float-66)
> 9. ... > Dsa = hp 3562A digital signal analyser > Most code is allready converted to visual basic, the lines 6, 7 and 8 not. > So if you only know how to do that please tell me.
I haven't been on an HP machine for awhile so I was searching for some old programs while watching this thread. I believe Duane is correct about lines 6 and 8.
probably initialized to the address of the dsa unit earlier in the program. This is usually done for readability and for ease of modification if the dsa address is changed later. Line 2 and 8 are outputing command strings to the unit. I can't tell what "DDAN" would do, but "LCL" is used to put the unit in "Local" mode. Line 3 is expecting a formatted input from the unit consisting of a 2 character string (becomes A$) and whatever the "W" represents (I forgot) (becomes Length). It might be an integer denoting bytes of data, if line 4 is any indication. Line 4 is integer division and can be done in VB as "Float = Length \ 8" or "Float = int(Length / 8)" Line 5 appears to be similar for VB and HPBASIC Line 7 is a matrix operation to output the contents of the entire matrix. You could do the same in VB using any loop structure. You may have to be careful to suppress CR/LF formatting between elements. (from line 6.) In a later post you state that you can send commands, but can't receive data - perhaps line 3 might offer a suggestion why, but you will want to consult the manual for the dsa data format and your driver documentation to see if you have compatibility problems. -CB
|
Fri, 20 Aug 2004 03:43:37 GMT |
|
|
|