Thursday, April 4, 2013

RS-232 , RS-422 , RS-485 - Differences and Typical Applications

RS-232 , RS-422 , RS-485 - Differences and Typical Applications

Why use RS-232 vs RS-485 and what is the real difference between RS-422 and RS-485? First, lets define each one. Keep in mind that all three are considered SERIAL, as opposed to IEEE-488 which is PARALLEL.
RS-232
Definitely the most popular interface, also being one of the first. However, things may soon change for obvious reasons. Any PC that is purchased will have one (and sometimes more) RS-232 port. Sometimes, they are simply referred to as SERIAL PORTS, however this may cause confusion since there are other Serial interfaces available. RS-232 is widely used because it is so readily available. You don't usually need to purchase an RS-232 port since it is available on any PC. However, it does have some disadvantages. Here are a few:
1. Limited Distance - Cable lengths are limited to 50 ft or less. Many will claim to go further, but this is not recommended, and is not part of the RS-232 specification. 2. Susceptible to Noise - RS-232 is single-ended, which means that the transmit and receive lines are referenced to a common ground 3. Not Multi-drop - You can only connect one RS-232 device per port. There are some devices designed to echo a command to a second unit of the same family of products, but this is very rare. This means that if you have 3 meters to connect to a PC, you will need 3 ports, or at least, an RS-232 multiplexor.

RS-422
RS-422 is similar to RS-232, and can be programmed in the same way, however, offers a few advantages and disadvantages. One problem is that you need to purchase an RS-422 port or at least an RS-422 to RS-232 converter, since PC's don't come standard with this interface. Also, you may find that there are fewer devices supporting RS-422. Some advantages are:
1. Long Distance Runs - Up to 500 feet is generally supported, and with repeaters, even further distances can be achieved. 2. Multi-Drop - Usually, up to 32 devices can be connected per port, and even more using repeaters. Devices are distinguished by unique addresses that are assigned to each device. For example, if you have 5 devices attached to a port, they would be addressed as units 1 to 5. If you want to communicate to unit #1, you send a command to unit #1. All units HEAR the command, but only the addressed unit will respond. This also applies to RS-485. The addresses can be set via switches or software, depending on the design of the device. 3. Noise Resistant - Since it uses a separate FLOATING transmit and receive pair (four wires), it offers better noise immunity than RS-232.

RS-485
RS-485 is very similar to RS-422. So much so that it often causes confusion. Both are multi-drop, and both can communicate via very long distances, so then why choose one over the other? First of all, RS-485 is generally a 2-wire system, although some manufacturers may specify 4-wire RS-485, which is far less common and very similar to RS-422. It is important that you identify which one is being employed when considering an instrument. Here are some main differences between 2-wire RS-485 and RS-422:
1. RS-485 can have multiple Commanding Devices and multiple Listening Devices. RS-422 can have only one Commander and multiple Listeners. For example, you can connect one PC (the Commanding device) to 10 temperature controllers (listeners). The PC can instruct any of the controllers to change setpoint, or to send a temperature reading, but none of the controllers can command any of the other controllers. With RS-485, you can have multiple PC's and multiple controllers on one bus, so that one PC can send a command to change a setpoint,and another PC can send a command to send back data, etc. Remember that all devices on the bus must have a unique unit address, so that only the addressed unit will respond. (similar to RS-422) 2. RS-485 wiring is easier since you are only dealing with 2 wires instead of 4. 3. Programming RS-485 is more difficult, since you are sending and receiving on the same two wires, you need to enable and disable the transmitter at the correct time so that you may perform proper communications. Imagine sending a command $2SEND out of the transmitter. If the transmitter is not turned off in time, then data being sent by another device will be missed. If the transmitter is turned off too quickly, there is a chance that part of the command $S2END will be truncated before it ever has a chance finishing the transmission of the character bits. When programming an RS-485 plug-in card, you would read the STATUS REGISTER to determine if it is time to switch or not. Some cards, such as the OMG-ULTRA-485 has an AUTO mode where it is intelligent enough to do this automatically, making it transparent to the programmer. Since RS-422, and RS-232 for that matter, have separate transmit and receive lines, they are easier to implement. Of course, there are other matters to consider such as handshaking, but will not be covered in this brief description. NOTE:IT MAY BE EASIER TO USE AN RS-232 TO RS-485 CONVERTER THAT SITS OUTSIDE THE PC. MAKE SURE THAT THE CONVERTER HAS INTELLIGENT CONTROL OF THE TRANSMITTERS SO THAT IT WILL AUTOMATICALLY TAKE CARE OF THE SWITCHING FOR YOU AND WILL BE TRANSPARENT TO THE USER. THEN, PROGRAM THE DEVICE AS YOU WOULD AN RS-422 OR RS-232 DEVICE. One such device is our model CAT-285.

Here are some typical wiring diagrams for each interface type:





Configuring a Schlage Handkey II for verification


How Do I configure the Biometric HandKey RSI for Verification?

1.       Check that the firmware installed in the 500B is the firmware for RSI. There are three firmwares available for 500B: RSI, Bioscript and Identix

2.       Enter the setup in the Handkey RSI by pressing CLEAR+ENTER

3.       The default password is 2

4.       SET LANGUAGE: set the language, default is English

5.       SET DATE FORMAT: set the Data and Time Format

6.       SET TIME AND DATE: set the Time and Date

7.       SET ADDRESS:

a.       Unit Adress: Set the address of the unit depending on the Port is connection from the 500B

b.       From Port 2 from LNL-500B:

                                                               i.      reader address in this order Reader 0, Reader 1, Reader 2, Reader 3.

c.       From Port 3 from LNL-500B:

                                                               i.      Reader 4, Reader 5, Reader 6, Reader 7.

8.       SET ID LENGTH: don’t need to configure

9.       FACILITY: don’t need to configure

10.   AUX CONTROL: don’t need to configure

11.   READER MODE: Remote

12.   SERIAL: Yes

a.       485: Yes

b.       Baud: 19200

c.       232: Yes

d.       Baud: anything
 

e.       USE RS-232 for: Printer

13.   DURESS: don’t need to configure

14.   BEEPER: don’t need to configure

15.   In OnGuard:

a.       Access Panel: Options: RSI Biometrics

b.       System Options: Biometrics: Set Maximum Templates and Default minimum score.

c.       In readers, in the biometric  reader, select the Primary Reader

d.       In readers, set Biometric Verify on the primary reader (the reader that is not the biometric, but is attached to the biometric reader)

16.   In Alarm Monitoring, under Options, Display Controller Capacity. Check the number of templates stored in the panel. If not templates are in the panel, it will not request the biometric template (hand) when you swipe a badge.

Good Numbers To Have



ADI 1-512-832-5440

Anixter 1-512-252-8383

Fairway Supply 1-512-452-6300

E24 Monitoring 1-800-877-3624


Tuesday, October 16, 2012

Good Cmd Commands

Basic Commands in the Command Line



   ADDUSERS Add or list users to/from a CSV file
   ADmodcmd Active Directory Bulk Modify
   ARP      Address Resolution Protocol
   ASSOC    Change file extension associations•
   ASSOCIAT One step file association
   ATTRIB   Change file attributes
b
   BCDBOOT  Create or repair a system partition
   BCDEDIT  Manage Boot Configuration Data
   BITSADMIN Background Intelligent Transfer Service
   BOOTCFG  Edit Windows boot settings
   BROWSTAT Get domain, browser and PDC info
c
   CACLS    Change file permissions
   CALL     Call one batch program from another•
   CERTREQ  Request certificate from a certification authority
   CD       Change Directory - move to a specific Folder•
   CHANGE   Change Terminal Server Session properties
   CHKDSK   Check Disk - check and repair disk problems
   CHKNTFS  Check the NTFS file system
   CHOICE   Accept keyboard input to a batch file
   CIPHER   Encrypt or Decrypt files/folders
   CleanMgr Automated cleanup of Temp files, recycle bin
   CLEARMEM Clear memory leaks
   CLIP     Copy STDIN to the Windows clipboard
   CLS      Clear the screen•
   CLUSTER  Windows Clustering
   CMD      Start a new CMD shell
   CMDKEY   Manage stored usernames/passwords
   COLOR    Change colors of the CMD window•
   COMP     Compare the contents of two files or sets of files
   COMPACT  Compress files or folders on an NTFS partition
   COMPRESS Compress individual files on an NTFS partition
   CON2PRT  Connect or disconnect a Printer
   CONVERT  Convert a FAT drive to NTFS
   COPY     Copy one or more files to another location•
   CSCcmd   Client-side caching (Offline Files)
   CSVDE    Import or Export Active Directory data 
d
   DATE     Display or set the date•
   DEFRAG   Defragment hard drive
   DEL      Delete one or more files•
   DELPROF  Delete user profiles
   DELTREE  Delete a folder and all subfolders
   DevCon   Device Manager Command Line Utility 
   DIR      Display a list of files and folders•
   DIRUSE   Display disk usage
   DISKPART Disk Administration
   DISKSHADOW Volume Shadow Copy Service
   DNSSTAT  DNS Statistics
   DOSKEY   Edit command line, recall commands, and create macros
   DriverQuery Display installed device drivers
   DSACLs   Active Directory ACLs
   DSAdd    Add items to active directory (user group computer) 
   DSGet    View items in active directory (user group computer)
   DSQuery  Search for items in active directory (user group computer)
   DSMod    Modify items in active directory (user group computer)
   DSMove   Move an Active directory Object
   DSRM     Remove items from Active Directory
e
   ECHO     Display message on screen•
   ENDLOCAL End localisation of environment changes in a batch file•
   ERASE    Delete one or more files•
   EVENTCREATE Add a message to the Windows event log
   EXIT     Quit the current script/routine and set an errorlevel•
   EXPAND   Uncompress files
   EXTRACT  Uncompress CAB files
f
   FC       Compare two files
   FIND     Search for a text string in a file
   FINDSTR  Search for strings in files
   FOR /F   Loop command: against a set of files•
   FOR /F   Loop command: against the results of another command•
   FOR      Loop command: all options Files, Directory, List•
   FORFILES Batch process multiple files
   FORMAT   Format a disk
   FREEDISK Check free disk space (in bytes)
   FSUTIL   File and Volume utilities
   FTP      File Transfer Protocol
   FTYPE    File extension file type associations•
g
   GETMAC   Display the Media Access Control (MAC) address
   GLOBAL   Display membership of global groups
   GOTO     Direct a batch program to jump to a labelled line•
   GPRESULT Display Resultant Set of Policy information
   GPUPDATE Update Group Policy settings
h
   HELP     Online Help
i
   iCACLS   Change file and folder permissions
   IF       Conditionally perform a command•
   IFMEMBER Is the current user a member of a Workgroup
   IPCONFIG Configure IP
k
   KILL     Remove a program from memory
l
   LABEL    Edit a disk label
   LOCAL    Display membership of local groups
   LOGEVENT Write text to the event viewer
   LOGMAN   Manage Performance Monitor
   LOGOFF   Log a user off
   LOGTIME  Log the date and time in a file
m
   MAPISEND Send email from the command line
   MBSAcli  Baseline Security Analyzer
   MEM      Display memory usage
   MD       Create new folders•
   MKLINK   Create a symbolic link (linkd)
   MODE     Configure a system device
   MORE     Display output, one screen at a time
   MOUNTVOL Manage a volume mount point
   MOVE     Move files from one folder to another•
   MOVEUSER Move a user from one domain to another
   MSG      Send a message
   MSIEXEC  Microsoft Windows Installer
   MSINFO32 System Information
   MSTSC    Terminal Server Connection (Remote Desktop Protocol)
   MV       Copy in-use files
n
   NET      Manage network resources
   NETDOM   Domain Manager
   NETSH    Configure Network Interfaces, Windows Firewall & Remote access
   NETSVC   Command-line Service Controller
   NBTSTAT  Display networking statistics (NetBIOS over TCP/IP)
   NETSTAT  Display networking statistics (TCP/IP)
   NOW      Display the current Date and Time 
   NSLOOKUP Name server lookup
   NTBACKUP Backup folders to tape
   NTRIGHTS Edit user account rights
o
   OPENFILES Query or display open files
p
   PATH     Display or set a search path for executable files•
   PATHPING Trace route plus network latency and packet loss
   PAUSE    Suspend processing of a batch file and display a message•
   PERMS    Show permissions for a user
   PERFMON  Performance Monitor
   PING     Test a network connection
   POPD     Return to a previous directory saved by PUSHD•
   PORTQRY  Display the status of ports and services
   POWERCFG Configure power settings
   PRINT    Print a text file
   PRINTBRM Print queue Backup/Recovery
   PRNCNFG  Display, configure or rename a printer
   PRNMNGR  Add, delete, list printers set the default printer
   PROMPT   Change the command prompt•
   PsExec     Execute process remotely
   PsFile     Show files opened remotely
   PsGetSid   Display the SID of a computer or a user
   PsInfo     List information about a system
   PsKill     Kill processes by name or process ID
   PsList     List detailed information about processes
   PsLoggedOn Who's logged on (locally or via resource sharing)
   PsLogList  Event log records
   PsPasswd   Change account password
   PsPing     Measure network performance
   PsService  View and control services
   PsShutdown Shutdown or reboot a computer
   PsSuspend  Suspend processes
   PUSHD    Save and then change the current directory•
q
   QGREP    Search file(s) for lines that match a given pattern
   Query Process    Display processes (TS/Remote Desktop)
   Query Session    Display all sessions (TS/Remote Desktop)
   Query TermServer List all servers (TS/Remote Desktop)
   Query User       Display user sessions (TS/Remote Desktop)
r
   RASDIAL  Manage RAS connections
   RASPHONE Manage RAS connections
   RECOVER  Recover a damaged file from a defective disk
   REG      Registry: Read, Set, Export, Delete keys and values
   REGEDIT  Import or export registry settings
   REGSVR32 Register or unregister a DLL
   REGINI   Change Registry Permissions
   REM      Record comments (remarks) in a batch file•
   REN      Rename a file or files•
   REPLACE  Replace or update one file with another
   Reset Session  Delete a Remote Desktop Session
   RD       Delete folder(s)•
   RMTSHARE Share a folder or a printer
   ROBOCOPY Robust File and Folder Copy
   ROUTE    Manipulate network routing tables
   RUN      Start | RUN commands
   RUNAS    Execute a program under a different user account
   RUNDLL32 Run a DLL command (add/remove print connections)

s
   SC       Service Control
   SCHTASKS Schedule a command to run at a specific time
   SCLIST   Display Services
   SET      Display, set, or remove session environment variables•
   SETLOCAL Control the visibility of environment variables•
   SETX     Set environment variables
   SFC      System File Checker 
   SHARE    List or edit a file share or print share
   ShellRunAs Run a command under a different user account
   SHIFT    Shift the position of batch file parameters•
   SHORTCUT Create a windows shortcut (.LNK file)
   SHOWGRPS List the Workgroups a user has joined
   SHOWMBRS List the Users who are members of a Workgroup
   SHUTDOWN Shutdown the computer
   SLEEP    Wait for x seconds
   SLMGR    Software Licensing Management (Vista/2008)
   SOON     Schedule a command to run in the near future
   SORT     Sort input
   START    Start a program, command or batch file•
   SU       Switch User
   SUBINACL Edit file and folder Permissions, Ownership and Domain
   SUBST    Associate a path with a drive letter
   SYSTEMINFO List system configuration
t
   TAKEOWN  Take ownership of a file
   TASKLIST List running applications and services
   TASKKILL Remove a running process from memory
   TIME     Display or set the system time•
   TIMEOUT  Delay processing of a batch file
   TITLE    Set the window title for a CMD.EXE session•
   TLIST    Task list with full path
   TOUCH    Change file timestamps    
   TRACERT  Trace route to a remote host
   TREE     Graphical display of folder structure
   TSSHUTDN Remotely shut down or reboot a terminal server
   TYPE     Display the contents of a text file•
   TypePerf Write performance data to a log file
u
   USRSTAT  List domain usernames and last login
v
   VER      Display version information•
   VERIFY   Verify that files have been saved•
   VOL      Display a disk label•
w
   WAITFOR  Wait for or send a signal
   WHERE    Locate and display files in a directory tree
   WHOAMI   Output the current UserName and domain
   WINDIFF  Compare the contents of two files or sets of files
   WINMSDP  Windows system report
   WINRM    Windows Remote Management
   WINRS    Windows Remote Shell
   WMIC     WMI Commands
   WUAUCLT  Windows Update
x
   XCACLS   Change file and folder permissions
   XCOPY    Copy files and folders
   ::       Comment / Remark•

Creating Camera Presets in Lenel Virtual Matrix



Creating Camera Presets in Lenel Virtual Matrix


FROM LENEL TECHNICAL SUPPORT:

Requirements

1)    LDVR environment
2)    Virtual Matrix Switch “Pelco D” protocol
3)    OnGuard Version 5.11.105 and later releases
4)    Camera Pelco Spectra Dome II or  III

Currently Lenel's GUI has no support for "set preset" command.  Originally, setting presets was done via matrix switcher's UI.  In the case of virtual matrix switcher, there is no UI.  The workaround is to temporarily replace the "go to preset" command with "set preset" command.  Thus typing the preset number and clicking the "go to preset" button will actually set the preset to the current position.

Process

Step 1

Configure Virtual Matrix and PTZ camera. Before proceeding to step 2. you have to be able to PTZ the camera through your mouse/keyboard via Alarm Monitoring.



Step 2 

Open System Administration ,Matrix Switch, Select “Pelco D Protocol” (Picture below is just example be sure to select Pelco “D” Protocol.




Please insert this string to Go To Preset Command:

<\255><%b><\000><\003><\000><%t><%x>


 Step 3

Go to Alarm Monitoring and create preset by navigating with mouse/keyboard and select preset points. Then type number or letter.(see below) and then click on icon below “Go to or set preset”  and click on it once complete.


 

Step 4

Open System Admin Matrix Switch, Select Pelco D Protocol

Please insert this string to Go To Preset Command:

<\255><%b><\000><\007><\000><%t><%x>


Step 5

Open Alarm Monitoring and type the preset number or letter that you created in Step 3, Then “Goto or Set preset” Icon. This will take you to the preset point that you created.

Whats my ip address?



What Is My IP Address? Who Knows?


Recently a customer asked for the ability to view their cameras remotely using an iPad.  No problem.  But, from a remote site the customer needs to know the public internet address of their video serverThere are a couple of free internet sites that can help with this.  Here's how:

1.  Go to the Video Server and open an internet browser.

2.  Navigate to www.whatsmyip.org

The site opens and displays the system's public IP address at the top.

3.  Use this address to configure the remote viewing software .

Also, when configuring remote viewing software you may have to specify a TCP Port to use in addition to the IP address.  This site includes a port scanning tool to determine if the port you need is open or if it is being blocked.  It displays the status of common ports and you can perform a custom port test and specify the port you need.

Here are some other sites:


http://www.whatismyip.com/


http://www.canyouseem.com

Scheduling Automatic Backups in SLQ



Schedule Automated Backups of SQL Database

From Article 1131 in the Lenel Knowledgebase

This refers to SQL Server 2005 Express, but has been successfully tested with 2008.

To back up an SQL Server database on a time schedule for an SQL Server 2005 Express system:

1) Create a folder named SQLBackup in the C:\ drive. 

2) Copy the following code, and then start Notepad. Paste the text into Notepad.

=============================================
DECLARE @BackupFile varchar(255), @DB varchar(30), @Description varchar(255), @LogFile varchar(50)
DECLARE @Name varchar(30), @MediaName varchar(30), @BackupDirectory nvarchar(200)
SET @BackupDirectory = 'C:\SQLBackup\'
Add a list of all databases you don't want to backup to this.
DECLARE Database_CURSOR CURSOR FOR SELECT name FROM sysdatabases WHERE name <> 'tempdb' AND name <> 'model' AND name <> 'Northwind' AND name <> 'master' AND name <> 'msdb'
OPEN Database_Cursor
FETCH next FROM Database_CURSOR INTO @DB
WHILE @@fetch_status = 0
    BEGIN
     SET @Name = @DB + '( Daily BACKUP )'
     SET @MediaName = @DB + '_Dump' + CONVERT(varchar, CURRENT_TIMESTAMP , 112)
     SET @BackupFile = @BackupDirectory + CONVERT(varchar, CURRENT_TIMESTAMP , 112) + "_" + @DB + '_' + 'Full' + '_' +
      '.bak'
     SET @Description = 'Normal' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
     IF (SELECT COUNT(*) FROM msdb.dbo.backupset WHERE database_name = @DB) > 0 OR @DB = 'master'
      BEGIN
       SET @BackupFile = @BackupDirectory + CONVERT(varchar, CURRENT_TIMESTAMP , 112) + "_"+ @DB + '_' + 'Full' + '_' + '.bak'
       SET some more pretty stuff for sql server.
       SET @Description = 'Full' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
      END
     ELSE
      BEGIN
       SET @BackupFile = @BackupDirectory + @DB + '_' + 'Full' + '_' +
        CONVERT(varchar, CURRENT_TIMESTAMP , 112) + '.bak'
       SET some more pretty stuff for sql server.
       SET @Description = 'Full' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
      END
      BACKUP DATABASE @DB TO DISK = @BackupFile
      WITH NAME = @Name, DESCRIPTION = @Description ,
      MEDIANAME = @MediaName, MEDIADESCRIPTION = @Description ,
      STATS = 10
     FETCH next FROM Database_CURSOR INTO @DB
END
CLOSE Database_Cursor
DEALLOCATE Database_Cursor
=============================================
3) From the File menu, select Save.

4) In the Save as type drop-down, select "All Files".

5) In the File name field type backup.sql. Save this file to the C:\SQLBackup folder.
6) Copy the following code, and then paste the text into Notepad.

=============================================
sqlcmd -S . -i "C:\SQLBackup\Backup.sql"
=============================================
7) From the File menu, select Save.

8) In the Save as type drop-down, select "All Files".

9) In the File name field type backup.bat. Save this file to the C:\SQLBackup folder.

10) Open Schedule Tasks in Windows (Click the Start button, then select All Programs > Accessories > System Tools > Scheduled Tasks).

11) Double-click Add Scheduled Task. The Scheduled Task Wizard opens.

12) Click [Next] on the first window.

13) On the window where you select the program you want Windows to run, click [Browse]. Navigate to the C:\SQLBackup\backup.bat file, and then click [Open].

14) Type a name for the task, select how frequently to perform the task, and then click [Next].

15) Select the time and day you want the task to start, along with the day(s) of the week to run the task. Click [Next].

16) Enter the Windows login (which is required), and then click [Next].

17) Click [Finish].
18) To test the schedule, right-click on the schedule in Scheduled Tasks and select Run. If the backup runs successfully, a Date_AccessControl.bak file will be created in the C:\SQLBackup folder.