Home AMX User Forum AMX Technical Discussion

Pelco-D Module

Has anyone played with the Pelco-D protocol? I'd assume someone has; is there anything I need to look out for? Anyone willing to share what they have?

Thanks in advance if anyone can help!

Comments

  • glr-ftiglr-fti Posts: 286
    This works for me...
    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
    }
    BUTTON_EVENT[dvTP,46] // UP
    BUTTON_EVENT[dvTP,47] // DOWN
    BUTTON_EVENT[dvTP,48] // LEFT
    BUTTON_EVENT[dvTP,49] // RIGHT
    BUTTON_EVENT[dvTP,50] // ENTER
    BUTTON_EVENT[dvTP,51] // DISPLAY
    BUTTON_EVENT[dvTP,52] // GUIDE
    BUTTON_EVENT[dvTP,57] // SUBTITLE
    {
    PUSH:
    {
    nTP_NUM=GET_LAST(dvTP) // WHICH TP IS THIS?
    SWITCH(nSOURCE[nTP_NUM])
    {

    CASE 271: // Camera
    {
    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]"
    }
    else SEND_STRING dvEquipPelco,"CAM1_COMMANDS[BUTTON.INPUT.CHANNEL-45]"
    }
    }
    }
    HOLD[2,REPEAT]:
    {
    SWITCH(nSOURCE[nTP_NUM])
    {
    CASE 271:
    {
    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]"
    }
    else SEND_STRING dvEquipPelco,"CAM1_COMMANDS[BUTTON.INPUT.CHANNEL-45]"
    }
    }
    }
    RELEASE:
    {
    SWITCH(nSOURCE[nTP_NUM])
    {
    CASE 271:
    {
    SEND_STRING dvEquipPelco,"CAM1_COMMANDS[7]"
    }
    }
    }
    }
    }
  • jjamesjjames Posts: 2,908
    Gary - thanks!!

    Do you need to keep sending a left/right/up/down command in order for it to keep going, or does it only stop when a stop command is issued? Just curious if the HOLD / REPEAT section is needed for it to move continuously.
  • shr00m-dewshr00m-dew Posts: 394
    From what I remember it will continue to move for a bit, but not forever. Best to continue repeating the command.

    I progressively increase the speed the longer the button is held. Makes it nice to get somewhere quick and still have fine control.
    BUTTON_EVENT[TP2,70] //UP
    {
    	PUSH:
    	{
    		HOLDTIME=20
    		PELCO_SEND($00,$08,$00,$14)
    	}
    	HOLD [1,REPEAT]:
    	{
    		HOLDTIME=HOLDTIME+2
    		IF (HOLDTIME<=63)
    			PELCO_SEND($00,$08,$00,HOLDTIME)
    		ELSE
    			PELCO_SEND($00,$08,$00,$3F)
    	}
    	RELEASE:
    	{
    		PELCO_SEND($00,$00,$00,$00)
    	}
    }
    

    Kevin D.
  • jjamesjjames Posts: 2,908
    Thanks. Good info before I get started with a module / code block. Gonna be fun, but seems a bit complicated if I wanna do a full module. :D
  • Parsing was a challenge because there's no set terminator character or delimiter. In order to find the end of the message sent back from the device you'll need to keep track of what command you initially sent to the device. The command string going to the device is formatted as STX, CamAddress, Cmd1, Cmd2, Data1, Data2, Checksum and the length of the response string will vary based on cmd1, cmd2. Besides that, the protocol and the control is very reliable and trouble-free.

    --John
Sign In or Register to comment.