Home AMX User Forum AMX General Discussion

B&K 2 Way

How can i get data and states of my unit (BK AVR 505) over 232. The protocol is somewhat confusing to me. Once the receiver sends me a string of data how can i pull that data out of the string ?

Example If i need feedback for volume level.

Does anyone know the commands?

Comments

  • ericmedleyericmedley Posts: 4,177
    davidv wrote: »
    How can i get data and states of my unit (BK AVR 505) over 232. The protocol is somewhat confusing to me. Once the receiver sends me a string of data how can i pull that data out of the string ?

    Example If i need feedback for volume level.

    Does anyone know the commands?

    That should have been covered in Programming I.

    You get the string data from a DATA_EVENT.

    If you go to the help menu and search for it, you'll see the syntax and whatnot.

    hope that helps
  • Jimweir192Jimweir192 Posts: 502
    As Eric says, you can use the string handler in the data_event or alternatively you can create a buffer and then parse the result to gain the information you need.

    It is well worth the time spent in learning how to parse a string using the tools available in Netlinx - there are many ways and very few are "wrong" - searching on these forums for parsing will give you many a pointer.

    Look at LEFT_STRING, MIDSTRING & REMOVE_STRING for starters
  • davidvdavidv Posts: 90
    CODE

    PROGRAM_NAME='AVR505 Sourve'

    Define_Device
    dvtp = 10001:1:1
    dvBK = 5001:1:1



    DEFINE_START
    data_event [dvBK]
    {
    String:
    {



    What do i type here to get the data from the string?
  • dthorsondthorson Posts: 103
    DEFINE_EVENT ///////////////// Device Communication
    DATA_EVENT[dvPLASMA]
    {
      ONLINE:
      {
    	SEND_COMMAND dvPLASMA,'SET BAUD 9600,N,8,1 485 DISABLE';
    	SEND_COMMAND dvPLASMA,'HSOFF';
    	
    	//lPowerTimeArray[1] = lPowerPollTime
    	//TIMELINE_CREATE(lPowerTimeLine,lPowerTimeArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)
    	lStatusTimeArray[1] = lStatusPollTime
    	TIMELINE_CREATE(lStatusTimeline,lStatusTimeArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)
      }
      STRING:
      {
    	CHAR cTrash[25];
    	
    	cPlasmaRX = DATA.TEXT;
    	
    	////////////////////////////////////////////////////////////////////////
    	///////////////// Static Feedback Commands
    	IF(FIND_STRING(cPlasmaRX,"$AA,$FF,$FF,$03,$41,$11,$01,$54",1) > 0)
    	{
    		  iPlasmaPower = 1;
    		  CALL 'SEND_STRING_FEEDBACK'(vdvPLASMA,'POWER',ITOA(iPlasmaPower));
    	}
    	IF(FIND_STRING(cPlasmaRX,"$AA,$FF,$FF,$03,$41,$11,$00,$53",1) > 0)
    	{
    		  iPlasmaPower = 0;
    		  CALL 'SEND_STRING_FEEDBACK'(vdvPLASMA,'POWER',ITOA(iPlasmaPower));
    	}
    	IF(FIND_STRING(cPlasmaRX,"$AA,$FF,$FF,$03,$41,$11,$02,$55",1) > 0) //Unit in standby/no PC sync
    	{
    		  iPlasmaPower = 0;
    		  CALL 'SEND_STRING_FEEDBACK'(vdvPLASMA,'POWER',ITOA(iPlasmaPower));
    	}
      }
    }
    
Sign In or Register to comment.