background image

2

CVS4 Component Video Switch

For comparison, here are the same examples and their associated CRC-8 checkcodes:

LI 2,3:16

LI 3,2:114

IL 2,3:22

KJ 2,3:145

Source Code Example of Calculating a Checksum

The following is a simple “C” program that calculates the checksum of the string “TestString” and 

then prints the initial string with the calculated checksum appended to it.

#include "stdio.h"

int main( void)

{

 

char 

 

 

TestString[] = "LI 2,3";

 

unsigned char  cksum;

 

int  

 

 

index;

 

char 

 

 

token = ';';

 

cksum = 0;  // initialize checksum

 

// Checksum all of 'TestString[]'

 

 

index = 0;

 

while (TestString[index] != '\0')

 

 

cksum += TestString[index++];

 

// Add the checksum token character ';' to checksum

 

cksum += token;

 

// Print the results

 

printf( "%s%c%u", TestString, token, (unsigned char)cksum);

 

return (0);

}

Checksums and CRC-8’s 

(Cont’d)

Summary of Contents for CVS4

Page 1: ...Z E K T O R Home Theater Switches Digital Video Component Video Multichannel Audio Rev 1 03 04 2006 High Definition Component Video Switch CVS4 Supplement to the CVS4 User Guide ...

Page 2: ... Query 11 Power Control 11 Output Mapping 12 Channel Select HDS4 2 Version 12 Front Panel Lighting Mode 13 Front Panel Lighting Mode HDS4 2 Version 13 Front Panel Light Intensities 14 Front Panel Light Intensities HDS4 2 Version 14 Save Power On Default Settings 15 Query Last IR Code Received 15 Set Learnable IR Command Codes 16 Front Panel Button Emulation 17 Query Status 19 Control Settings 19 C...

Page 3: ... USB to RS 232 conversion cable these are all typically straight through cables The RS 232 port is a female type DE 9 connector sometimes mistakenly referred to as a DB 9 connector with the following pinout 5 4 3 2 1 9 8 7 6 Pin definitions 1 No Connect 6 No Connect 2 TX 7 No Connect 3 RX 8 No Connect 4 No Connect 9 No Connect 5 GND The port settings used by the CVS4 are Baudrate 9600 Data Bits 8 ...

Page 4: ...CR will turn on the power of most Zektor devices The spaces between the P and 1 are optional Since commands consist of alpha characters only there can never be a P1 command and P1 will always be interpreted as P 1 When a command has more than one parameter the parameters are separated by either whitespace s or a comma or both whitespace s and a comma for instance LI 3 13 CR or LI 3 13 CR will set ...

Page 5: ...le and or disable different device operations Binary arithmetic is used to represent bitmapped parameters it is assumed the reader has some familiarity with binary arithmetic An example of a command that uses a bitmapped parameter is the XS settings CR com mand which is defined like this XS settings CR Where settings is a bitmapped parameter Decimal Value 128 64 32 16 8 4 2 1 Bit Position 7 6 5 4 ...

Page 6: ...RC 8 checkcode may be appended to any command and if given will be calculated by the device and compared with the given value If a mismatch occurs an error will be returned and the command will not be executed This can be used to help assure reliable op eration in noisy environments Checksums are more commonly used in serial protocols however CRC 8 checkcodes offer a more secure means of insuring ...

Page 7: ...e buffer before the command string was issued The ESC clears the buffer allowing the V 145 CR to be processed error free It is legitimate to prefix all commands with the ESC character to assure the buffer is always empty before the command string is received which may be helpful in a very noisy environment The Response Strings A response will always be returned whenever a CR is received There are ...

Page 8: ...a single routine to issue a command and check for an Acknowlegement or an Error Response String whether or not the command queries for a response An example of an error response IL CR Sent Command characters transposed no such command 2 CR LF Received Error Response indicating unknown command In this case the Error Response string 2 CR LF was issued instead of the acknowledg ment string since the ...

Page 9: ...ve mode No information will be sent from the device without first receiving a request from the controller For controllers that cannot handle having information being sent to them in the background or at unspecified times the Master Slave setting is ideal since all state changes will be logged but not sent until requested by the controller To allow for more efficient Master Slave operations there i...

Page 10: ...d Out 1 remapped to In 3 CR LF Received Acknowledgment Response P 0 Received unsolicited Power turned off LI 2 13 CR LF Received Query Response for LED intensities This represents a worst case scenario where unsolicited responses appear throughout the com munication sequence First the LI CR command was issued by the controller While looking for an Acknowledgement or Error Response string an unsoli...

Page 11: ...he Acknowledgement or possible Error Responses were allowed to pass When the LI 2 13 CR LF response is eventually received it will be handled like any other unsolicited response Using K I S S in the Asynchronous mode is nearly as easy as using it in the Master Slave mode allowing for the creation of simple to write but highly effective device drivers K I S S Continued ...

Page 12: ... 8 error 5 CR LF Too many or too few parameters 6 CR LF System busy cannot process command 7 CR LF Buffer overflow And some more detailed descriptions of their meanings Error 1 The command given was not recognized as a CVS4 command Commands are case sensitive and in the CVS4 all commands are upper case Error 2 One of the parameters given was too large or too small the command will be ignored Error...

Page 13: ...ptional checksum or CRC 8 checkcodes that may be appended to all commands nor does it show the required CR that terminates all commands The response strings are the actual strings returned from CVS4 which except for the cases of backward compatibility with the HDS4 2 return the same format as described above The format does not show the optional checksum or CRC 8 checkcodes that may be appended to...

Page 14: ... a selected input O in Set output to input in O Query for current setting O Query for current setting Response String O in Where in Current input being mapped to the CVS4 s output Channel Select HDS4 2 Version Note This command exists for backwards compatibility with the HDS4 2 use the Output Map ping command in new designs Selects the current CVS4 channel C in Select channel in See Note 1 C Query...

Page 15: ...panel lights LM 1 Set the front panel lights to always DIM LM 2 Set the front panel lights to always BRIGHT LM 3 Set the front panel lights to AUTODIM after 4 seconds LM Query for current setting LM Query for current setting Response String LM m Where m Current Lamp Mode setting Front Panel Lighting Mode HDS4 2 Version Note This command exists for backwards compatibility with the HDS4 2 use the LM...

Page 16: ... the LM 2 command When LM 3 is selected the front panel will dim from bright to dim after about four seconds of inactivity LI dim bright Set the DIM and BRIGHT levels to dim and bright LI dim Set only the DIM level to dim LI bright Set only the BRIGHT level to bright LI Query for current settings LI Query for current settings Response String LI dim bright Where dim Current DIM level setting bright...

Page 17: ... generate a range error Query Last IR Code Received This command allows the controller to read the hash values returned by Zektor s IIR Intel ligent Infra Red decoding firmware Zektor s IIR algorithm converts all IR codes it receives to a compressed 72 bit hash value The original IR transmission is decoded and all timing and bit patterns are compressed and hashed into a unique 72 bit meaningless b...

Page 18: ...ode small this command sends the 72 bit IR code as an 18 digit hexadecimal value IR Query for the IR code of the last IR command received IR Query for the IR code of the last IR command received Response String IR ircode Where ircode 18 hex digits 0 9 A F representing the most recent IR code received This command returns a single digit 0 if there are no IR codes waiting to be read Set Learnable IR...

Page 19: ...nd allows the controller to detect front panel button presses even when the front panel is disabled This allows the controller very tight control over the CVS4 By disabling the front panel setting the FP bit to 0 in the Control Settings command and by then processing the front panel button presses of the CVS4 a controller can redefine the operations of the CVS4 When used in combination with the Re...

Page 20: ...his command that cannot be gener ated by the keyboard making this command a bit more useful These extended codes allow for better control of the CVS4 Some extended button codes are Code Description 0 When Issued Exits setup modes 0 When Queried No buttons have been pressed since last the query 100 Always toggle power like Power Toggle without the need of a release code 101 Discrete power on always...

Page 21: ...ad by issuing the proper query command the associated flag wll be reset Q Query for current flag values Q Query for current flag values Response String Qflags Where flags is a bitmapped parameter Decimal Value 128 64 32 16 8 4 2 1 Bit Position 7 6 5 4 3 2 1 0 Name CTL LMO IRC IRR BTN LIN SEL PWR PWR 1 Power State has changed SEL 1 Selection Input Output Mapping has changed LIN 1 Lighting Intensity...

Page 22: ...t Panel 1 Front Panel Enabled IRE 0 Disable IR remote 1 Enable IR remote IRS 0 Turn on IR Sensor 1 Turn off IR Sensor IRJ 0 Turn on IR Jack 1 Turn off IR Jack CSE 0 Disable CS and CRC 8 1 Append either Checksums or CRC 8 to responses CRC 0 Append Checksums 1 Append CRC 8 s to reponses 0 Reserved always set to 0 The 2nd parameter is a Backup Control Settings flag If it is non zero then the current ...

Page 23: ... 2 there is no space after the command in the response string Extended Control Settings In the Asynchronous mode of operation the CVS4 will transmit state changes as they occur This command allows individual control over which state changes will be sent This CVS4 allows control over the following states Power State changes On Off condition Selection changes input output mapping changes Front Panel...

Page 24: ...al Value 128 64 32 16 8 4 2 1 Bit Position 7 6 5 4 3 2 1 0 Name CTL LMO IRC IRR BTN LIN SEL PWR Factory Settings 0 0 0 0 0 0 1 1 PWR 1 Power State has changed SEL 1 Selection Input Output Mapping has changed LIN 1 Lighting Intensity Level Settings have changed BTN 1 One or more buttons have been pressed IRR 1 A new IR code has been received IRC 1 New IR codes have been learned LMO 1 Lighting Mode ...

Page 25: ...23 CVS4 Component Video Switch CVS4 Command Reference Cont d ...

Page 26: ...Cyclic Redundancy Code CRC Polynomial Selection For Embedded Networks by Philip Koopman Tridib Chakravarty http www ece cmu edu koopman roses dsn04 koopman04_crc_poly_embedded pdf Another source of CRC information is the CRC entry on Wikipedia the free encyclopedia http en wikipedia org wiki Cyclic_redundancy_check Differences between a Checksum and a CRC 8 Checkcode A CRC is capable of finding ma...

Page 27: ...the string TestString and then prints the initial string with the calculated checksum appended to it include stdio h int main void char TestString LI 2 3 unsigned char cksum int index char token cksum 0 initialize checksum Checksum all of TestString index 0 while TestString index 0 cksum TestString index Add the checksum token character to checksum cksum token Print the results printf s c u TestSt...

Page 28: ...ows us to read in each bit starting with bit 0 of each byte instead of bit 7 This is done because the UART sends its LSB first and by doing the same we are able to preserve the CRC s burst error detection characteristics So x 8 x 6 x 3 x 2 1 101001101 14D hex Ignore X 8 01001101 4D hex Reverse bit order 10110010 B2 hex define CRC8_POLY 0xB2 polynomial mask define CRC8_INIT 0xFF initial value void ...

Page 29: ...initialize checkcode CRC8 all of TestString index 0 while TestString index 0 crcByte crc8 TestString index Add the CRC 8 token character to CRC 8 crcByte crc8 token Finish with CRC8 by doing a one s compliment crc8 crc8 Print the results printf s c u TestString token unsigned char crc8 return 0 Checksums and CRC 8 s Cont d ...

Page 30: ...28 CVS4 Component Video Switch This page left intentionaly nearly blank ...

Page 31: ...29 CVS4 Component Video Switch This page left intentionaly nearly blank ...

Page 32: ...Z E K T O R Z E K T O R 12675 Danielson Ct Suite 401 Poway CA 92064 858 748 8250 www zektor com ...

Reviews: