• Support
  • Articles
  • Resources
  • Products

Bug in SendMulticast Command

Moderator: boris

2 postsPage 1 of 1

jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Mon Mar 06, 2017 5:41 am
I originally posted this in Questions and Answers section, but this is probably the right place for it (see http://logmett.com/support-forums/2/sen ... -will-2977).

I have observed an interesting behavior that I was not expecting. If I send out the integers from 0x00 to 0xFF using the Send command, they go out just fine, but if I try to send them out with the SendMulticast command 0x00 and 0x01 don't work. The 0x00 just doesn't seem to get sent and the 0x00 gets sent as 0xFF! I already switched the language to English from UTF-8 so that the upper values from 0x80 to 0xFF would send properly as a single byte.

My test setup is as follows:
1. Terminal 1 (named Terminal1) is connected to COM1
2. Terminal 2 (named Terminal2) is connected to COM2
3. I am running a RealTerm Terminal on COM3 (set to display received data as hex)
4. COM2 and COM3 are physically connected with a null-modem cable

If I run the following macro on Terminal 2, I get the numbers from 0x00 to 0xFF on the RealTerm Terminal on COM3 as expected:
for i 0x00 0xFF
send i
next

If I run the equivalent macro on Terminal 1, I get 0xFF and the numbers from 0x02 to 0xFF on the RealTerm Terminal on COM3, NOT as expected:
for i 0x00 0xFF
SendMulticast "Terminal1" i
next

This is causing no small problem in my macro since all of the bytes with a value of 0x00 are getting skipped and the ones with a value of 0x01 are getting converted to 0xFF.
jcorra
Newbie

Posts:
10
Joined: Mon Mar 06, 2017 4:36 am
by jcorra » Thu Mar 09, 2017 7:48 pm
I'm not sure if this is related or significant, but I have observed a similar behavior with the DispStr command. If I have debug mode on in hex mode, I would expect that whatever integer I try to display with DispStr (from $00 to $FF) should show up. So, if I used DispStr $00, I would expect to see 0 0 space show up on my terminal, or if I used DispStr $55, I would expect 5 5 space to show up on my terminal, which is what I have observed for the most part. There are a few integers though that do not seem to behave "properly" as follows:
    $00: is skipped and not displayed (just like the SendMulticast won't actually transmit the $00)
    $01: displays F F space if I have not set a multicast name (just like the Send Multicast)
    $01: displays F F space and all but the first 2 characters of the name assigned to the terminal with SetMulticastName command
    $0B: displays 0 B space and then the equivalent of "~macroE_12608_xx.ttl" (where xx is a number that increments each time I run the macro)
    $14: displays 1 4 space and then the complete name assigned to the terminal with SetMulticastName command

So, when I expect this to be displayed:
00
01
0B
14
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF

Instead I get:
FF 72 6D 69 6E 61 6C 5F 36
0B 7E 6D 61 63 72 6F 45 5F 31 32 36 30 38 5F 34 37 2E 74 74 6C
14 54 65 72 6D 69 6E 61 6C 5F 36
FF 65 72 6D 69 6E 61 6C 5F 36 02 03 04 05 06 07 08 09 0A 0B 7E 6D 61 63 72 6F 45 5F 31 32 36 30 38 5F 34 37 2E 74 74 6C 0C 0D 0E 0F
10 11 12 13 14 54 65 72 6D 69 6E 61 6C 5F 36 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF

When I transmit $00 to $FF directly it comes out just fine at the other terminal. When I use the SendMultiCast, it messes up only the first 2 characters as already mentioned. If I turn local echo on and send $00 to $Ff then I get the full $00 to $FF both displayed on my screen and transmitted, so I know that TeraTerm is capable of transmitting the correct thing and displaying it on the screen, there is just some peculiar behavior with both the SendMultiCast and DispStr commands when trying to use them with integers as the notes say you should be able to do. "If the <data> is an integer type, its lowest-order byte (0-255) is regarded as an ASCII code of the character, and the corresponding character is displayed on the terminal screen." and "If <data> is an integer, its lowest-order byte (0-255) is regarded as an ASCII code of the character, and the character is sent to the host. "

Here is the code I used to test this

Code: Select all

  1. connect '/c=6'
  2. ; wait until the connection has completed
  3. testlink
  4. i = 0
  5. while ((result != 2) and (i < 15))
  6.     mpause 200
  7.     testlink
  8.     i = i + 1
  9. endwhile
  10.  
  11. if result != 2 then
  12.     messagebox "Unable to connect with COM6!" "!!!ERROR MESSAGE!!!"
  13.     closett
  14.     goto End_of_Test
  15. endif
  16.  
  17. ; now that the connection should be established
  18.  
  19. term_name = "Terminal_6"
  20. SetMulticastName term_name
  21. SetBaud 115200
  22. SetDebug 2
  23. SetEcho 0
  24. FlushRecv
  25.  
  26. for i $00 $FF
  27.     send i
  28. next
  29. pause 2
  30. for i $00 $FF
  31.     SendMulticast term_name i
  32. next
  33. pause 2
  34. FlushRecv
  35. dispstr $00
  36. dispstr $01
  37. dispstr $0B
  38. dispstr $14
  39. for i $00 $FF
  40.     dispstr i
  41. next
  42. pause 2
  43. SetEcho 1
  44. for i $00 $FF
  45.     send i
  46. next
  47. :End_of_Test
Display posts from previous:
Sort by:

2 postsPage 1 of 1

Users browsing this forum: No registered users