Results 1 to 2 of 2

Thread: Translation from QBasic to Visual Basic 6.0

  1. #1

    Thread Starter
    Lively Member djklocek's Avatar
    Join Date
    Aug 2006
    Posts
    107

    Translation from QBasic to Visual Basic 6.0

    Hello.
    I have the code below and I have to translate it to VB 6.0. I'm in despair so could anybody help me with that? Thank you in advance and best regards

    VB Code:
    1. CLS
    2. LOCATE 1, 1
    3. DIM cmd$(100), resp$(1000)
    4. ’ Set up serial port for 9600 baud, even parity, 7 bits;
    5. ’ Ignore Request to Send and Carrier Detect; Send line feed,
    6. ’ enable parity check, reserve 1000 bytes for input buffer
    7. OPEN "com1:9600,e,7,2,rs,cd,lf,pe" FOR RANDOM AS #1 LEN = 1000
    8. ’ Put the multimeter into the remote operation mode
    9. PRINT #1, ":SYST:REM"
    10. ’ Query the multimeter’s id string
    11. PRINT #1, "*IDN?"
    12. LINE INPUT #1, resp$
    13. PRINT "*IDN? returned: ", resp$
    14. ’ Ask what revision of SCPI the multimeter conforms to
    15. PRINT #1, ":SYST:VERS?"
    16. LINE INPUT #1, resp$
    17. PRINT ":SYST:VERS? returned: ", resp$
    18. ’ Send a message to the multimeter’s display, and generate a beep
    19. PRINT #1, ":SYST:BEEP;:DISP:TEXT ’34401A’"
    20. ’ Configure the multimeter for dc voltage readings,
    21. ’ 10 V range, 0.1 V resolution, 4 readings
    22. PRINT #1, ":CONF:VOLT:DC 10,0.1;:SAMP:COUN 4"
    23. ’ Trigger the readings, and fetch the results
    24. PRINT #1, ":READ?"
    25. LINE INPUT #1, resp$
    26. PRINT ":READ? returned: ", resp$
    27. END

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Translation from QBasic to Visual Basic 6.0

    Apart from the first two lines (which aren't needed) I think it should all work in a VB form as it is.

    It would be better to use more conventional methods to communicate with the com port if you can (the MsComm control I think), but I'm afraid I dont have any examples for you - there are many on the forums tho, so a search should find something useful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width