Home AMX User Forum NetLinx Studio
Options

Problem with zero 0 in string

In am trying to SEND_STRING to device from buffer, in facet when I receive sometfing from one device, i remove few bytes, and want to send it to another device.

Problem is that

SEND_STRING 0:1:0,somevariable

is sending UP TO ZERO !!!!!

Is there solution to solve this ?

Comments

  • Options
    Joe TJoe T Posts: 10
    VladaPUB wrote: »
    In am trying to SEND_STRING to device from buffer, in facet when I receive sometfing from one device, i remove few bytes, and want to send it to another device.

    Problem is that

    SEND_STRING 0:1:0,somevariable

    is sending UP TO ZERO !!!!!

    Is there solution to solve this ?

    I don't know if this is your problebem but
    when doing IP that ports 1 & 2 are reserved.

    Joe
  • Options
    RonenRonen Posts: 55
    VladaPUB how do you know that you send it up to the zero?
    is this zero a Hex number or an ascii code?
    as far as i know, when you look in netlinx diagnostics with a Hex numbers coming in or going out, it will cut the string at $00 and won't show you the rest of the string altough there might be some other strings in the buffer coming in / going out.

    Ronen
  • Options
    DHawthorneDHawthorne Posts: 4,584
    This is a fairly well known problem, but it only affects your debug window, and terminal screen (send_string 0). The null character goes out the port just fine, you just won't see it on screen. Apparently the display routines use a library that terminates strings on a null, so when it hits the zero, it stops displaying it. But it's only a display error, the code still goes out the port.
  • Options
    kbeattyAMXkbeattyAMX Posts: 358
    If you want to verify that the Zero is being send, use RealTerm and set your PC up as a Telnet Server. Open an IP client in the Netlinx to your PC and send the string (SEND_STRING) to that device (Telnet Client). You should see that everything is fine.
  • Options
    viningvining Posts: 4,368
    You can also just convert your string before sending to 0.
               STACK_VAR CHAR cProj_DeBug_Str[1024] ;
    
               nLenStr = length_string(DATA.TEXT) ;
    	  for(n = 1 ; n <= nLenStr ; n++)
    	       {
    	       if(n == 1)
    		    {
    		    cProj_DeBug_Str = "itoa(DATA.TEXT[n])" ;
    		    }
    	       else
    		    {
    		    cProj_DeBug_Str = "cProj_DeBug_Str,',',itoa(DATA.TEXT[n])" ;
    		    }
    	       }
    	  fnProj_DeBug("'RX STR (DECIMAL): ',cProj_DeBug_Str,' :DEBUG line-<',ITOA(__LINE__),'>'") ;
    

    This will print out the ASCII representation of the incoming decimal values. Do the same for outgoing if you choose.
    Line      1 (09:54:52)::  Video_Projector.axi: RX STR (DECIMAL): 34,1,0,208,0,243 :DEBUG line-<214>
    
Sign In or Register to comment.