-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JVisa whether you can read and write 16-base data? #14
Comments
Please give an example of what you want to do |
The string Demonstration: public static void main(String[] args) {
printStringBytesInHex("ABCD");
printStringBytesInHex("01 03 00 80 00 07");
}
private static void printStringBytesInHex(String str) {
final byte[] bytes = str.getBytes(java.nio.charset.StandardCharsets.US_ASCII);
for (int i = 0; i < bytes.length; i++) {
System.out.printf("%02X ", bytes[i]);
}
System.out.println();
} Sample output:
Table of ASCII characters: I will add JVisaInstrument methods to send bytes instead of a string. |
It's not what I wanted, thank you! I don't speak English very well and didn't describe the problem clearly! Thank you very much for your reply ,It's a pleasure to communicate with you, can you leave a contact information?
…------------------ 原始邮件 ------------------
发件人: "Peter ***@***.***>;
发送时间: 2024年3月14日(星期四) 上午7:36
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [pfroud/JVisa] JVisa whether you can read and write 16-base data? (Issue #14)
The string "01 03 00 80 00 07" contains the character 0, then the character 1, then a space character, and so on.
Demonstration:
public static void main(String[] args) { printStringBytesInHex("ABCD"); printStringBytesInHex("01 03 00 80 00 07"); } private static void printStringBytesInHex(String str) { final byte[] bytes = str.getBytes(java.nio.charset.StandardCharsets.US_ASCII); for (int i = 0; i < bytes.length; i++) { System.out.printf("%02X ", bytes[i]); } System.out.println(); }
Sample output:
41 42 43 44 30 31 20 30 33 20 30 30 20 38 30 20 30 30 20 30 37
Table of ASCII characters:
I will add JVisaInstrument methods to send bytes instead of a string.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
You are welcome! I added methods to write
Let me know if you need help getting the new code. |
Can you test the new method to write a |
JVisa whether you can read and write 16-base data?
can you give an example?
The text was updated successfully, but these errors were encountered: