coco2
Members-
Content Count
1 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Everything posted by coco2
-
newbie question, calling PRESET 95 to set camera address
coco2 replied to coco's topic in Security Cameras
thanks again for the feedback Soundy, i've found the problem now. i had to order a second rs-485 to usb adapter to compare the data sent by the software PTZ controller against that of the ebay remote controller and it turns out the problem was the remote controller the whole time the remote controller was sending data but it was not matching the pelco d protocol specifications. since i was not sure if i was doing something wrong i made sure the baud rate and protocol are correct in the configuration and compared the data against the one sent by the software controller that matches the specs. i'm now 100% sure that the ebay controller is a useless piece of s*** i tried and it was not the problem but thanks for telling me it's safe to do! the settings are displayed but it does not show the address it has configured (and it seems it had none set from factory). but playing with the software controller i've been able to confirm that the camera not only works fine, i could open the menu and change the settings. btw the camera did respond to address 0. to make sure i'm understanding it and that everything is working correctly i also made a small perl script that sends the basic pelco commands from the linux command line and it works without problem, i'll leave it here if anyone wants to play with it. i know it's simple and dirty but i'm not a programmer and it works fine for testing and understanding the protocol again thanks all for the feedback! #!/usr/bin/perl use strict; use warnings; use Device::SerialPort; use Getopt::Std; my $target='00'; getopt('c:'); our($opt_c); my $cmd = $opt_c; if (!defined $cmd) { print "Usage: prog -c <up|down|right|left|menu|zoom{0,1}|iris{0,1}|focus{0,1}>\n\n"; exit -1; } my $serial=Device::SerialPort->new("/dev/ttyUSB0"); $serial->databits("8"); $serial->baudrate("2400"); $serial->parity("none"); $serial->stopbits(1); print "target is $target\n"; if ($opt_c =~ /menu/) { print "command is menu\n"; &send($target, '00', '03', '00', '5f', '62'); } elsif ($opt_c =~ /up/) { print "command is up\n"; &send($target, '00', '08', '00', '20', '28'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /down/) { print "command is down\n"; &send($target, '00', '10', '00', '20', '30'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /right/) { print "command is right\n"; &send($target, '00', '02', '20', '00', '22'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /left/) { print "command is left\n"; &send($target, '00', '04', '20', '00', '24'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /zoom0/) { print "command is zoom0\n"; &send($target, '00', '40', '00', '00', '40'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /zoom1/) { print "command is zoom1\n"; &send($target, '00', '20', '00', '00', '20'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /iris0/) { print "command is iris0\n"; &send($target, '04', '00', '00', '00', '04'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /iris1/) { print "command is iris1\n"; &send($target, '02', '00', '00', '00', '02'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /focus0/) { print "command is focus0\n"; &send($target, '00', '80', '00', '00', '80'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } elsif ($opt_c =~ /focus1/) { print "command is focus1\n"; &send($target, '01', '00', '00', '00', '01'); sleep 1 ; &send($target, '00', '00', '00', '00', '00'); } else { print "unknown command\n"; exit -1; } sleep 1; $serial->close; sub send { my($adr,$cmd1,$cmd2,$dat1,$dat2,$sum)=@_; print "* sending ff $adr $cmd1 $cmd2 $dat1 $dat2 $sum\n"; $serial->write(pack ('H2' x 7, 'ff', $adr, $cmd1, $cmd2, $dat1, $dat2, $sum)); }