Home AMX User Forum NetLinx Studio

RS232 and HEX

How can I assign a hex command string to a variable or constant and the transmit it? I tried putting this statement under the define_constant section:
dvProjVidInput = "$02,$41,$44,$5A,$5A,$3B,$49,$49,$53,$3A,$56,$49,$44,$03"

And then send it with:

SEND_STRING dvProj, dvProjvidinput

I am seeing $02,$41,$44,$5A,$5A,$3B,$49,$49,$53,$3A,$56,$49,$44,$03 out the comm port but if I do this:

SEND_STRING dvProj, "$02,$41,$44,$5A,$5A,$3B,$49,$49,$53,$3A,$56,$49,$44,$03"

it works... What am I missing?

Comments

  • dvProjVidInput = "$02,$41,$44,$5A,$5A,$3B,$49,$49,$53,$3A,$56,$49,$ 44,$03"

    Should be as
     ProjVidInput[] ={$02,$41,$44,$5A,$5A,$3B,$49,$49,$53,$3A,$56,$49,$44,$03}
    
    Send_String dvProj, ProjVidInput
    

    Define_Constant is fine for this
  • glr-ftiglr-fti Posts: 286
    How is variable defined? Here is an example of an integer array
    INTEGER CAM1_COMMANDS[][]=
    {
         {$FF,$01,$88,$88,$25,$35,$6B}		// UP
        ,{$FF,$01,$88,$90,$25,$35,$73}		// DOWN
        ,{$FF,$01,$88,$84,$35,$25,$67}		// LEFT
        ,{$FF,$01,$88,$82,$35,$25,$65}		// RIGHT
        ,{$FF,$01,$88,$C0,$25,$00,$6E}		// TELE Wide
        ,{$FF,$01,$88,$A0,$25,$00,$4E}		// TELE Zoom
        ,{$FF,$01,$00,$00,$00,$00,$01}		// STOP
    }
    }
    
    SWITCH(nSOURCE[nTP_NUM])
    	{
    	    CASE 25:
    	    {
    		IF( BUTTON.INPUT.CHANNEL=50 OR				// tele wide and tele zoom need a stop to make press and hold work
    		    BUTTON.INPUT.CHANNEL=51)
    		{
    		    SEND_STRING dvEquipPelco,"CAM1_COMMANDS[BUTTON.INPUT.CHANNEL-45]"
    		    SEND_STRING dvEquipPelco,"CAM1_COMMANDS[7]"
    		}
    	    }
    
    
  • Thanks

    Thanks Guys!! I knew it was something simple on my part that was amiss.
Sign In or Register to comment.