• Support
  • Articles
  • Resources
  • Products

sending hex values in tera term

Moderator: boris

18 postsPage 1 of 1

padma
Newbie

Posts:
2
Joined: Mon Oct 17, 2016 9:11 am
by padma » Mon Oct 17, 2016 9:16 am
Hi, I am new to teraterm.

for my application, I want to send a command in hex value.

I searched the forum. But I didn't find the result properly.

I am requesting anyone to help me or provide me the links.


thanks
padma
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Mon Oct 24, 2016 8:20 am
What exactly do you mean by "send a command in hex value"? How is the command terminated? Can you provide an example?

You can send hex/binary from a macro e.g.

send 0x31 as raw byte value

Code: Select all

  1. value = $31
  2. send value

or send as 2 char hex string representing a byte

Code: Select all

  1. value = $31
  2. sprintf2 command "%02X" value
  3. send command

Regards
Trevor
padma
Newbie

Posts:
2
Joined: Mon Oct 17, 2016 9:11 am
by padma » Mon Oct 24, 2016 9:34 am
Hi,

My command looks like 00 03 00 63 00 01 C5 75 and all are hex values.

can you please tell how to use macro or provide some links??

thanks in advance
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Thu Nov 03, 2016 4:16 pm
can you please tell how to use macro or provide some links??
Here you go:
http://ttssh2.osdn.jp/manual/en/macro/
dpena
Coach

Posts:
144
Joined: Thu Jul 09, 2009 6:14 pm
by dpena » Tue Jan 17, 2017 8:56 pm
Hi padma,

Are these hex values incrementing or are they some testlist of commands which are fixed values?? :?
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Wed Mar 01, 2017 5:44 pm
Trevor wrote:What exactly do you mean by "send a command in hex value"? How is the command terminated? Can you provide an example?

You can send hex/binary from a macro e.g.

send 0x31 as raw byte value

Code: Select all

  1. value = $31
  2. send value

or send as 2 char hex string representing a byte

Code: Select all

  1. value = $31
  2. sprintf2 command "%02X" value
  3. send command

Regards
Trevor




hi, i need help in something similar too, i am trying to use DB9 null modem cable for communication. i nee to how do i send commands in teraterm in hex.
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Fri Mar 03, 2017 10:24 am
Hi luxlcd,
Do you want to send hex from a Tera Term macro or some other way?

As per my question above what exactly do you mean by hex? Do you mean a raw byte (which may not be printable) or do you mean 2 character string representing a hex value for a byte?

Please provide some examples.

Trevor
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Fri Mar 03, 2017 5:00 pm
Trevor wrote:Hi luxlcd,
Do you want to send hex from a Tera Term macro or some other way?

As per my question above what exactly do you mean by hex? Do you mean a raw byte (which may not be printable) or do you mean 2 character string representing a hex value for a byte?

Please provide some examples.

Trevor




hello Trevor


here is the whole situation

i am trying to use teraterm for sending commands to communicate to a analog to digital interface card. i am not at all familiar with doing comands n stuff. i have spec sheet here which has list of all the 4 bit and 5 bit commads , each bit differs for every single function.
here is what they have

0xf4 0x88 id0x35 0xfd 0xfe


these are given in different columns , i dont know if they should have space between them or not. how do i enter this in teraterm... do i just write what i see and press enter? sorry for such silly questions i have never done before, i am totally a hardware peson.
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Fri Mar 03, 2017 9:48 pm
Do have a document for the digital interface card you can point me to?.
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Fri Mar 03, 2017 10:08 pm
Trevor wrote:Do have a document for the digital interface card you can point me to?.




i have attached the image, i am trying to do command for " KEY_MENU" , because it is the easy way to get visible response. if this command works, then it should pop up MENU on the screen that interface card is driving.

i have no idea how do i enter these commands.
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Sat Mar 04, 2017 12:47 am
cannot see the image attachment you refer to, maybe the forum will not support such attachments. Can you make a link e.g. dropbox or google drive etc. ? Or refer me to the website for the device. If I have some data I can figure it out otherwise I'm blind.
jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Mon Mar 06, 2017 5:01 am
Just a word of caution when trying to send hex data. It seems to work best when you write a macro to send the commands you want and to set up the command in the macro as an integer rather than character or string (especially if you want to be able to send 0x00). The integer allows you to send 0 where you can't do that with a string. Also, if you are communicating binary/hex data, you will want to make sure that you change the language from the default of UTF-8 to English (go to Setup-->General-->Language, select English, hit ok, and then save the new setup: go to Setup-->Save Setup...). If you leave it as UTF-8 you will probably run into issues trying to send values above 0x7F (for example trying to send 0xF1 gets sent as two bytes (I don't remember off the top of my head which two), but when you use English it goes out as the 0xF1 you would expect).
jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Mon Mar 06, 2017 4:35 pm
Tera Term is really text based and will give you fits if you try to operate at a lower level for hex data (but it is possible). It seems to be intended and best suited for sending/receiving printable ascii characters.

For example, if you open Tera Term and connect to your desired serial/COM port then the ASCII/hex value of each key you type on the keyboard will be sent out serially to the device connected on that serial port and anything it sends back to you will show up in your terminal window. So, if you type the following keys: "T" "h" "i" "s" " " "i" "s" " " "a" " " "c" "o" "m" "m" "a" "n" "d", it will actually transmit the hex value corresponding to each ASCII character as you type (which from an ASCII lookup table you will find is 0x54(T), 0x68(h), 0x69(i), 0x73(s), 0x20( ), 0x69(i), 0x73(s), 0x20( ), 0x61(a), 0x20( ), 0x63(c), 0x6F(o), 0x6D(m), 0x6D(m), 0x61(a), 0x6E(n), and 0x64(d)). This is fine as long as the hex values you want to use are between 0x20 and 0x7F and generally correspond to the keys on your keyboard (0x00 to 0x1F are the command characters that don't print to the screen). You will have to do a lot of translating from the keyboard key (ascii character to the equivalent hex value), but it can be done.

If the commands you need to send to your device need to use the hex values from 0x00 to 0x1F or 0x80 to 0xFF, then you will most likely need to bite the bullet and learn how to write simple macros that will transmit the commands you want. They don't have to be big and scary and can be quite simple actually. For example, you could write a simple macro for each command you want to send and then from Tera Term you would run the macro for the command you want to send (select Control-->Macro, and it will open up a window that lets you browse to and select the macro you want to run in Tera Term). If you are going to be getting responses back from the serial device, then you will probably want to put Tera Term in debug mode so that it displays each received byte as a hex number separated by spaces (so instead of seeing "COM1=" coming from the device you would see the raw hex data 43 4F 4D 31 3D). Trevor already gave you some good samples. The macros are just simple text files that give commands to Tera Term (such as to transmit data). At its most simple your macro could be a text file saved as command1.ttl with the following lines:
setdebug 2 ; this sets the Tera Term window to display all received data as hex bytes separated by spaces
send $F4
send $88
send $35
send $FD
send $FE

If you use the TTLEditor to do this it would look something like:

Code: Select all

  1. setdebug 2 ; this sets the Tera Term window to display all received data as hex bytes separated by spaces
  2. send $F4
  3. send $88
  4. send $35
  5. send $FD
  6. send $FE
  7.  
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Mon Mar 06, 2017 4:49 pm
thanku everyone who is trying to help me. here is the link for that picture i took from the commands manual.


https://www.dropbox.com/s/60pzn8tglif2w1c/11.jpg?dl=0
jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Mon Mar 06, 2017 5:23 pm
Are there other parts to the command structure? Based on what you posted, the command sequence should be revised as follows:
send CMD
send Data1
send Data2
send Data3
send Data4
where the values for CMD, Data1, Data2, Data3, and Data4 are derived from your user manual. If your ID is 0x35 and you want to send the KEY_MENU key code then:
send $F4
send $88
send $35
send $FD
send $43

Since you are sending values above $7F, make sure that you have changed your language from UTF-8 to English as I mentioned a few posts above.
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Mon Mar 06, 2017 7:01 pm
Thankyou so much for help everyone. i really appreciate it.
jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Mon Mar 06, 2017 7:30 pm
Were you able to get it working?
luxlcd
Newbie

Posts:
6
Joined: Tue Feb 28, 2017 9:09 pm
by luxlcd » Mon Mar 06, 2017 7:33 pm
jcorra wrote:Were you able to get it working?



not yet because i am working on another project today.
Display posts from previous:
Sort by:

18 postsPage 1 of 1

Users browsing this forum: No registered users