Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    ?9999FF1B? : 0
    ?9998FF1B? : 1
    
  2. or download this
    9999 = 57 + 57 + 57 + 57 = 228.
    ~ 228 = -229 decimal = FF1B hex (16-bit)
    Add the header and trailer characters = <SOH>9999FF1B<ETX>
    
  3. or download this
    1 + 57 + 57 + 57 + 57 = 229
    
  4. or download this
    FF1B = 65307
    
  5. or download this
    (65307 + 229) = 65536
    65536 & 65535 = 0x10000 & 0xFFFF = 0
    
  6. or download this
    sub build_string {
        my( $string ) = @_;
    ...
    
        return chr(1) . $string . sprintf( '%4x', $chksum ) . chr(3);
    }