cosmicvoid
Master
So what happens if you remove the "S"?
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Private Sub Initialize_CRC_Lookup_Table()
crcLookupTable(0).Lo = &H0S
crcLookupTable(0).Hi = &H0S
crcLookupTable(1).Lo = &H89S
crcLookupTable(1).Hi = &H11S
crcLookupTable(2).Lo = &H12S
crcLookupTable(2).Hi = &H23S
crcLookupTable(3).Lo = &H9BS
crcLookupTable(3).Hi = &H32S
crcLookupTable(4).Lo = &H24S
crcLookupTable(4).Hi = &H46S
crcLookupTable(5).Lo = &HADS
crcLookupTable(5).Hi = &H57S
crcLookupTable(6).Lo = &H36S
crcLookupTable(6).Hi = &H65S
crcLookupTable(7).Lo = &HBFS
crcLookupTable(7).Hi = &H74S
crcLookupTable(8).Lo = &H48S
crcLookupTable(8).Hi = &H8CS
crcLookupTable(9).Lo = &HC1S
crcLookupTable(9).Hi = &H9DS
crcLookupTable(10).Lo = &H5AS
crcLookupTable(10).Hi = &HAFS
crcLookupTable(11).Lo = &HD3S
crcLookupTable(11).Hi = &HBES
crcLookupTable(12).Lo = &H6CS
crcLookupTable(12).Hi = &HCAS
crcLookupTable(13).Lo = &HE5S
crcLookupTable(13).Hi = &HDBS
crcLookupTable(14).Lo = &H7ES
crcLookupTable(14).Hi = &HE9S
crcLookupTable(15).Lo = &HF7S
crcLookupTable(15).Hi = &HF8S
crcLookupTable(16).Lo = &H81S
crcLookupTable(16).Hi = &H10S
crcLookupTable(17).Lo = &H8S
crcLookupTable(17).Hi = &H1S
crcLookupTable(18).Lo = &H93S
crcLookupTable(18).Hi = &H33S
crcLookupTable(19).Lo = &H1AS
crcLookupTable(19).Hi = &H22S
crcLookupTable(20).Lo = &HA5S
crcLookupTable(20).Hi = &H56S
crcLookupTable(21).Lo = &H2CS
crcLookupTable(21).Hi = &H47S
crcLookupTable(22).Lo = &HB7S
crcLookupTable(22).Hi = &H75S
crcLookupTable(23).Lo = &H3ES
crcLookupTable(23).Hi = &H64S
crcLookupTable(24).Lo = &HC9S
crcLookupTable(24).Hi = &H9CS
crcLookupTable(25).Lo = &H40S
crcLookupTable(25).Hi = &H8DS
crcLookupTable(26).Lo = &HDBS
crcLookupTable(26).Hi = &HBFS
crcLookupTable(27).Lo = &H52S
crcLookupTable(27).Hi = &HAES
crcLookupTable(28).Lo = &HEDS
crcLookupTable(28).Hi = &HDAS
crcLookupTable(29).Lo = &H64S
crcLookupTable(29).Hi = &HCBS
crcLookupTable(30).Lo = &HFFS
crcLookupTable(30).Hi = &HF9S
crcLookupTable(31).Lo = &H76S
crcLookupTable(31).Hi = &HE8S
crcLookupTable(32).Lo = &H2S
crcLookupTable(32).Hi = &H21S
crcLookupTable(33).Lo = &H8BS
crcLookupTable(33).Hi = &H30S
crcLookupTable(34).Lo = &H10S
crcLookupTable(34).Hi = &H2S
crcLookupTable(35).Lo = &H99S
crcLookupTable(35).Hi = &H13S
crcLookupTable(36).Lo = &H26S
crcLookupTable(36).Hi = &H67S
crcLookupTable(37).Lo = &HAFS
crcLookupTable(37).Hi = &H76S
crcLookupTable(38).Lo = &H34S
crcLookupTable(38).Hi = &H44S
crcLookupTable(39).Lo = &HBDS
crcLookupTable(39).Hi = &H55S
crcLookupTable(40).Lo = &H4AS
crcLookupTable(40).Hi = &HADS
crcLookupTable(41).Lo = &HC3S
crcLookupTable(41).Hi = &HBCS
crcLookupTable(42).Lo = &H58S
crcLookupTable(42).Hi = &H8ES
crcLookupTable(43).Lo = &HD1S
crcLookupTable(43).Hi = &H9FS
crcLookupTable(44).Lo = &H6ES
crcLookupTable(44).Hi = &HEBS
crcLookupTable(45).Lo = &HE7S
crcLookupTable(45).Hi = &HFAS
crcLookupTable(46).Lo = &H7CS
crcLookupTable(46).Hi = &HC8S
crcLookupTable(47).Lo = &HF5S
crcLookupTable(47).Hi = &HD9S
crcLookupTable(48).Lo = &H83S
crcLookupTable(48).Hi = &H31S
crcLookupTable(49).Lo = &HAS
crcLookupTable(49).Hi = &H20S
crcLookupTable(50).Lo = &H91S
crcLookupTable(50).Hi = &H12S
crcLookupTable(51).Lo = &H18S
crcLookupTable(51).Hi = &H3S
crcLookupTable(52).Lo = &HA7S
crcLookupTable(52).Hi = &H77S
crcLookupTable(53).Lo = &H2ES
crcLookupTable(53).Hi = &H66S
crcLookupTable(54).Lo = &HB5S
crcLookupTable(54).Hi = &H54S
crcLookupTable(55).Lo = &H3CS
crcLookupTable(55).Hi = &H45S
crcLookupTable(56).Lo = &HCBS
crcLookupTable(56).Hi = &HBDS
crcLookupTable(57).Lo = &H42S
crcLookupTable(57).Hi = &HACS
crcLookupTable(58).Lo = &HD9S
crcLookupTable(58).Hi = &H9ES
crcLookupTable(59).Lo = &H50S
crcLookupTable(59).Hi = &H8FS
crcLookupTable(60).Lo = &HEFS
crcLookupTable(60).Hi = &HFBS
crcLookupTable(61).Lo = &H66S
crcLookupTable(61).Hi = &HEAS
crcLookupTable(62).Lo = &HFDS
crcLookupTable(62).Hi = &HD8S
crcLookupTable(63).Lo = &H74S
crcLookupTable(63).Hi = &HC9S
crcLookupTable(64).Lo = &H4S
crcLookupTable(64).Hi = &H42S
crcLookupTable(65).Lo = &H8DS
crcLookupTable(65).Hi = &H53S
crcLookupTable(66).Lo = &H16S
crcLookupTable(66).Hi = &H61S
crcLookupTable(67).Lo = &H9FS
crcLookupTable(67).Hi = &H70S
crcLookupTable(68).Lo = &H20S
crcLookupTable(68).Hi = &H4S
crcLookupTable(69).Lo = &HA9S
crcLookupTable(69).Hi = &H15S
crcLookupTable(70).Lo = &H32S
crcLookupTable(70).Hi = &H27S
crcLookupTable(71).Lo = &HBBS
crcLookupTable(71).Hi = &H36S
crcLookupTable(72).Lo = &H4CS
crcLookupTable(72).Hi = &HCES
crcLookupTable(73).Lo = &HC5S
crcLookupTable(73).Hi = &HDFS
crcLookupTable(74).Lo = &H5ES
crcLookupTable(74).Hi = &HEDS
crcLookupTable(75).Lo = &HD7S
crcLookupTable(75).Hi = &HFCS
crcLookupTable(76).Lo = &H68S
crcLookupTable(76).Hi = &H88S
crcLookupTable(77).Lo = &HE1S
crcLookupTable(77).Hi = &H99S
crcLookupTable(78).Lo = &H7AS
crcLookupTable(78).Hi = &HABS
crcLookupTable(79).Lo = &HF3S
crcLookupTable(79).Hi = &HBAS
crcLookupTable(80).Lo = &H85S
crcLookupTable(80).Hi = &H52S
crcLookupTable(81).Lo = &HCS
crcLookupTable(81).Hi = &H43S
crcLookupTable(82).Lo = &H97S
crcLookupTable(82).Hi = &H71S
crcLookupTable(83).Lo = &H1ES
crcLookupTable(83).Hi = &H60S
crcLookupTable(84).Lo = &HA1S
crcLookupTable(84).Hi = &H14S
crcLookupTable(85).Lo = &H28S
crcLookupTable(85).Hi = &H5S
crcLookupTable(86).Lo = &HB3S
crcLookupTable(86).Hi = &H37S
crcLookupTable(87).Lo = &H3AS
crcLookupTable(87).Hi = &H26S
crcLookupTable(88).Lo = &HCDS
crcLookupTable(88).Hi = &HDES
crcLookupTable(89).Lo = &H44S
crcLookupTable(89).Hi = &HCFS
crcLookupTable(90).Lo = &HDFS
crcLookupTable(90).Hi = &HFDS
crcLookupTable(91).Lo = &H56S
crcLookupTable(91).Hi = &HECS
crcLookupTable(92).Lo = &HE9S
crcLookupTable(92).Hi = &H98S
crcLookupTable(93).Lo = &H60S
crcLookupTable(93).Hi = &H89S
crcLookupTable(94).Lo = &HFBS
crcLookupTable(94).Hi = &HBBS
crcLookupTable(95).Lo = &H72S
crcLookupTable(95).Hi = &HAAS
crcLookupTable(96).Lo = &H6S
crcLookupTable(96).Hi = &H63S
crcLookupTable(97).Lo = &H8FS
crcLookupTable(97).Hi = &H72S
crcLookupTable(98).Lo = &H14S
crcLookupTable(98).Hi = &H40S
crcLookupTable(99).Lo = &H9DS
crcLookupTable(99).Hi = &H51S
crcLookupTable(100).Lo = &H22S
crcLookupTable(100).Hi = &H25S
crcLookupTable(101).Lo = &HABS
crcLookupTable(101).Hi = &H34S
crcLookupTable(102).Lo = &H30S
crcLookupTable(102).Hi = &H6S
crcLookupTable(103).Lo = &HB9S
crcLookupTable(103).Hi = &H17S
crcLookupTable(104).Lo = &H4ES
crcLookupTable(104).Hi = &HEFS
crcLookupTable(105).Lo = &HC7S
crcLookupTable(105).Hi = &HFES
crcLookupTable(106).Lo = &H5CS
crcLookupTable(106).Hi = &HCCS
crcLookupTable(107).Lo = &HD5S
crcLookupTable(107).Hi = &HDDS
crcLookupTable(108).Lo = &H6AS
crcLookupTable(108).Hi = &HA9S
crcLookupTable(109).Lo = &HE3S
crcLookupTable(109).Hi = &HB8S
crcLookupTable(110).Lo = &H78S
crcLookupTable(110).Hi = &H8AS
crcLookupTable(111).Lo = &HF1S
crcLookupTable(111).Hi = &H9BS
crcLookupTable(112).Lo = &H87S
crcLookupTable(112).Hi = &H73S
crcLookupTable(113).Lo = &HES
crcLookupTable(113).Hi = &H62S
crcLookupTable(114).Lo = &H95S
crcLookupTable(114).Hi = &H50S
crcLookupTable(115).Lo = &H1CS
crcLookupTable(115).Hi = &H41S
crcLookupTable(116).Lo = &HA3S
crcLookupTable(116).Hi = &H35S
crcLookupTable(117).Lo = &H2AS
crcLookupTable(117).Hi = &H24S
crcLookupTable(118).Lo = &HB1S
crcLookupTable(118).Hi = &H16S
crcLookupTable(119).Lo = &H38S
crcLookupTable(119).Hi = &H7S
crcLookupTable(120).Lo = &HCFS
crcLookupTable(120).Hi = &HFFS
crcLookupTable(121).Lo = &H46S
crcLookupTable(121).Hi = &HEES
crcLookupTable(122).Lo = &HDDS
crcLookupTable(122).Hi = &HDCS
crcLookupTable(123).Lo = &H54S
crcLookupTable(123).Hi = &HCDS
crcLookupTable(124).Lo = &HEBS
crcLookupTable(124).Hi = &HB9S
crcLookupTable(125).Lo = &H62S
crcLookupTable(125).Hi = &HA8S
crcLookupTable(126).Lo = &HF9S
crcLookupTable(126).Hi = &H9AS
crcLookupTable(127).Lo = &H70S
crcLookupTable(127).Hi = &H8BS
crcLookupTable(128).Lo = &H8S
crcLookupTable(128).Hi = &H84S
crcLookupTable(129).Lo = &H81S
crcLookupTable(129).Hi = &H95S
crcLookupTable(130).Lo = &H1AS
crcLookupTable(130).Hi = &HA7S
crcLookupTable(131).Lo = &H93S
crcLookupTable(131).Hi = &HB6S
crcLookupTable(132).Lo = &H2CS
crcLookupTable(132).Hi = &HC2S
crcLookupTable(133).Lo = &HA5S
crcLookupTable(133).Hi = &HD3S
crcLookupTable(134).Lo = &H3ES
crcLookupTable(134).Hi = &HE1S
crcLookupTable(135).Lo = &HB7S
crcLookupTable(135).Hi = &HF0S
crcLookupTable(136).Lo = &H40S
crcLookupTable(136).Hi = &H8S
crcLookupTable(137).Lo = &HC9S
crcLookupTable(137).Hi = &H19S
crcLookupTable(138).Lo = &H52S
crcLookupTable(138).Hi = &H2BS
crcLookupTable(139).Lo = &HDBS
crcLookupTable(139).Hi = &H3AS
crcLookupTable(140).Lo = &H64S
crcLookupTable(140).Hi = &H4ES
crcLookupTable(141).Lo = &HEDS
crcLookupTable(141).Hi = &H5FS
crcLookupTable(142).Lo = &H76S
crcLookupTable(142).Hi = &H6DS
crcLookupTable(143).Lo = &HFFS
crcLookupTable(143).Hi = &H7CS
crcLookupTable(144).Lo = &H89S
crcLookupTable(144).Hi = &H94S
crcLookupTable(145).Lo = &H0S
crcLookupTable(145).Hi = &H85S
crcLookupTable(146).Lo = &H9BS
crcLookupTable(146).Hi = &HB7S
crcLookupTable(147).Lo = &H12S
crcLookupTable(147).Hi = &HA6S
crcLookupTable(148).Lo = &HADS
crcLookupTable(148).Hi = &HD2S
crcLookupTable(149).Lo = &H24S
crcLookupTable(149).Hi = &HC3S
crcLookupTable(150).Lo = &HBFS
crcLookupTable(150).Hi = &HF1S
crcLookupTable(151).Lo = &H36S
crcLookupTable(151).Hi = &HE0S
crcLookupTable(152).Lo = &HC1S
crcLookupTable(152).Hi = &H18S
crcLookupTable(153).Lo = &H48S
crcLookupTable(153).Hi = &H9S
crcLookupTable(154).Lo = &HD3S
crcLookupTable(154).Hi = &H3BS
crcLookupTable(155).Lo = &H5AS
crcLookupTable(155).Hi = &H2AS
crcLookupTable(156).Lo = &HE5S
crcLookupTable(156).Hi = &H5ES
crcLookupTable(157).Lo = &H6CS
crcLookupTable(157).Hi = &H4FS
crcLookupTable(158).Lo = &HF7S
crcLookupTable(158).Hi = &H7DS
crcLookupTable(159).Lo = &H7ES
crcLookupTable(159).Hi = &H6CS
crcLookupTable(160).Lo = &HAS
crcLookupTable(160).Hi = &HA5S
crcLookupTable(161).Lo = &H83S
crcLookupTable(161).Hi = &HB4S
crcLookupTable(162).Lo = &H18S
crcLookupTable(162).Hi = &H86S
crcLookupTable(163).Lo = &H91S
crcLookupTable(163).Hi = &H97S
crcLookupTable(164).Lo = &H2ES
crcLookupTable(164).Hi = &HE3S
crcLookupTable(165).Lo = &HA7S
crcLookupTable(165).Hi = &HF2S
crcLookupTable(166).Lo = &H3CS
crcLookupTable(166).Hi = &HC0S
crcLookupTable(167).Lo = &HB5S
crcLookupTable(167).Hi = &HD1S
crcLookupTable(168).Lo = &H42S
crcLookupTable(168).Hi = &H29S
crcLookupTable(169).Lo = &HCBS
crcLookupTable(169).Hi = &H38S
crcLookupTable(170).Lo = &H50S
crcLookupTable(170).Hi = &HAS
crcLookupTable(171).Lo = &HD9S
crcLookupTable(171).Hi = &H1BS
crcLookupTable(172).Lo = &H66S
crcLookupTable(172).Hi = &H6FS
crcLookupTable(173).Lo = &HEFS
crcLookupTable(173).Hi = &H7ES
crcLookupTable(174).Lo = &H74S
crcLookupTable(174).Hi = &H4CS
crcLookupTable(175).Lo = &HFDS
crcLookupTable(175).Hi = &H5DS
crcLookupTable(176).Lo = &H8BS
crcLookupTable(176).Hi = &HB5S
crcLookupTable(177).Lo = &H2S
crcLookupTable(177).Hi = &HA4S
crcLookupTable(178).Lo = &H99S
crcLookupTable(178).Hi = &H96S
crcLookupTable(179).Lo = &H10S
crcLookupTable(179).Hi = &H87S
crcLookupTable(180).Lo = &HAFS
crcLookupTable(180).Hi = &HF3S
crcLookupTable(181).Lo = &H26S
crcLookupTable(181).Hi = &HE2S
crcLookupTable(182).Lo = &HBDS
crcLookupTable(182).Hi = &HD0S
crcLookupTable(183).Lo = &H34S
crcLookupTable(183).Hi = &HC1S
crcLookupTable(184).Lo = &HC3S
crcLookupTable(184).Hi = &H39S
crcLookupTable(185).Lo = &H4AS
crcLookupTable(185).Hi = &H28S
crcLookupTable(186).Lo = &HD1S
crcLookupTable(186).Hi = &H1AS
crcLookupTable(187).Lo = &H58S
crcLookupTable(187).Hi = &HBS
crcLookupTable(188).Lo = &HE7S
crcLookupTable(188).Hi = &H7FS
crcLookupTable(189).Lo = &H6ES
crcLookupTable(189).Hi = &H6ES
crcLookupTable(190).Lo = &HF5S
crcLookupTable(190).Hi = &H5CS
crcLookupTable(191).Lo = &H7CS
crcLookupTable(191).Hi = &H4DS
crcLookupTable(192).Lo = &HCS
crcLookupTable(192).Hi = &HC6S
crcLookupTable(193).Lo = &H85S
crcLookupTable(193).Hi = &HD7S
crcLookupTable(194).Lo = &H1ES
crcLookupTable(194).Hi = &HE5S
crcLookupTable(195).Lo = &H97S
crcLookupTable(195).Hi = &HF4S
crcLookupTable(196).Lo = &H28S
crcLookupTable(196).Hi = &H80S
crcLookupTable(197).Lo = &HA1S
crcLookupTable(197).Hi = &H91S
crcLookupTable(198).Lo = &H3AS
crcLookupTable(198).Hi = &HA3S
crcLookupTable(199).Lo = &HB3S
crcLookupTable(199).Hi = &HB2S
crcLookupTable(200).Lo = &H44S
crcLookupTable(200).Hi = &H4AS
crcLookupTable(201).Lo = &HCDS
crcLookupTable(201).Hi = &H5BS
crcLookupTable(202).Lo = &H56S
crcLookupTable(202).Hi = &H69S
crcLookupTable(203).Lo = &HDFS
crcLookupTable(203).Hi = &H78S
crcLookupTable(204).Lo = &H60S
crcLookupTable(204).Hi = &HCS
crcLookupTable(205).Lo = &HE9S
crcLookupTable(205).Hi = &H1DS
crcLookupTable(206).Lo = &H72S
crcLookupTable(206).Hi = &H2FS
crcLookupTable(207).Lo = &HFBS
crcLookupTable(207).Hi = &H3ES
crcLookupTable(208).Lo = &H8DS
crcLookupTable(208).Hi = &HD6S
crcLookupTable(209).Lo = &H4S
crcLookupTable(209).Hi = &HC7S
crcLookupTable(210).Lo = &H9FS
crcLookupTable(210).Hi = &HF5S
crcLookupTable(211).Lo = &H16S
crcLookupTable(211).Hi = &HE4S
crcLookupTable(212).Lo = &HA9S
crcLookupTable(212).Hi = &H90S
crcLookupTable(213).Lo = &H20S
crcLookupTable(213).Hi = &H81S
crcLookupTable(214).Lo = &HBBS
crcLookupTable(214).Hi = &HB3S
crcLookupTable(215).Lo = &H32S
crcLookupTable(215).Hi = &HA2S
crcLookupTable(216).Lo = &HC5S
crcLookupTable(216).Hi = &H5AS
crcLookupTable(217).Lo = &H4CS
crcLookupTable(217).Hi = &H4BS
crcLookupTable(218).Lo = &HD7S
crcLookupTable(218).Hi = &H79S
crcLookupTable(219).Lo = &H5ES
crcLookupTable(219).Hi = &H68S
crcLookupTable(220).Lo = &HE1S
crcLookupTable(220).Hi = &H1CS
crcLookupTable(221).Lo = &H68S
crcLookupTable(221).Hi = &HDS
crcLookupTable(222).Lo = &HF3S
crcLookupTable(222).Hi = &H3FS
crcLookupTable(223).Lo = &H7AS
crcLookupTable(223).Hi = &H2ES
crcLookupTable(224).Lo = &HES
crcLookupTable(224).Hi = &HE7S
crcLookupTable(225).Lo = &H87S
crcLookupTable(225).Hi = &HF6S
crcLookupTable(226).Lo = &H1CS
crcLookupTable(226).Hi = &HC4S
crcLookupTable(227).Lo = &H95S
crcLookupTable(227).Hi = &HD5S
crcLookupTable(228).Lo = &H2AS
crcLookupTable(228).Hi = &HA1S
crcLookupTable(229).Lo = &HA3S
crcLookupTable(229).Hi = &HB0S
crcLookupTable(230).Lo = &H38S
crcLookupTable(230).Hi = &H82S
crcLookupTable(231).Lo = &HB1S
crcLookupTable(231).Hi = &H93S
crcLookupTable(232).Lo = &H46S
crcLookupTable(232).Hi = &H6BS
crcLookupTable(233).Lo = &HCFS
crcLookupTable(233).Hi = &H7AS
crcLookupTable(234).Lo = &H54S
crcLookupTable(234).Hi = &H48S
crcLookupTable(235).Lo = &HDDS
crcLookupTable(235).Hi = &H59S
crcLookupTable(236).Lo = &H62S
crcLookupTable(236).Hi = &H2DS
crcLookupTable(237).Lo = &HEBS
crcLookupTable(237).Hi = &H3CS
crcLookupTable(238).Lo = &H70S
crcLookupTable(238).Hi = &HES
crcLookupTable(239).Lo = &HF9S
crcLookupTable(239).Hi = &H1FS
crcLookupTable(240).Lo = &H8FS
crcLookupTable(240).Hi = &HF7S
crcLookupTable(241).Lo = &H6S
crcLookupTable(241).Hi = &HE6S
crcLookupTable(242).Lo = &H9DS
crcLookupTable(242).Hi = &HD4S
crcLookupTable(243).Lo = &H14S
crcLookupTable(243).Hi = &HC5S
crcLookupTable(244).Lo = &HABS
crcLookupTable(244).Hi = &HB1S
crcLookupTable(245).Lo = &H22S
crcLookupTable(245).Hi = &HA0S
crcLookupTable(246).Lo = &HB9S
crcLookupTable(246).Hi = &H92S
crcLookupTable(247).Lo = &H30S
crcLookupTable(247).Hi = &H83S
crcLookupTable(248).Lo = &HC7S
crcLookupTable(248).Hi = &H7BS
crcLookupTable(249).Lo = &H4ES
crcLookupTable(249).Hi = &H6AS
crcLookupTable(250).Lo = &HD5S
crcLookupTable(250).Hi = &H58S
crcLookupTable(251).Lo = &H5CS
crcLookupTable(251).Hi = &H49S
crcLookupTable(252).Lo = &HE3S
crcLookupTable(252).Hi = &H3DS
crcLookupTable(253).Lo = &H6AS
crcLookupTable(253).Hi = &H2CS
crcLookupTable(254).Lo = &HF1S
crcLookupTable(254).Hi = &H1ES
crcLookupTable(255).Lo = &H78S
crcLookupTable(255).Hi = &HFS
End Sub
crcLookupTable(0).Lo = &H0
crcLookupTable(0).Hi = &H0
crcLookupTable(1).Lo = &H89
crcLookupTable(1).Hi = &H11
crcLookupTable(2).Lo = &H12
crcLookupTable(2).Hi = &H23
crcLookupTable(3).Lo = &H9B
crcLookupTable(3).Hi = &H32
crcLookupTable(4).Lo = &H24
crcLookupTable(4).Hi = &H46
crcLookupTable(5).Lo = &HAD
crcLookupTable(5).Hi = &H57
crcLookupTable(6).Lo = &H36
crcLookupTable(6).Hi = &H65
crcLookupTable(7).Lo = &HBF
crcLookupTable(7).Hi = &H74
crcLookupTable(8).Lo = &H48
crcLookupTable(8).Hi = &H8C
crcLookupTable(9).Lo = &HC1
crcLookupTable(9).Hi = &H9D
crcLookupTable(10).Lo = &H5A
crcLookupTable(10).Hi = &HAF
crcLookupTable(11).Lo = &HD3
crcLookupTable(11).Hi = &HBE
crcLookupTable(12).Lo = &H6C
crcLookupTable(12).Hi = &HCA
crcLookupTable(13).Lo = &HE5
crcLookupTable(13).Hi = &HDB
crcLookupTable(14).Lo = &H7E
crcLookupTable(14).Hi = &HE9
crcLookupTable(15).Lo = &HF7
crcLookupTable(15).Hi = &HF8
crcLookupTable(16).Lo = &H81
crcLookupTable(16).Hi = &H10
crcLookupTable(17).Lo = &H8
crcLookupTable(17).Hi = &H1
crcLookupTable(18).Lo = &H93
crcLookupTable(18).Hi = &H33
crcLookupTable(19).Lo = &H1A
crcLookupTable(19).Hi = &H22
crcLookupTable(20).Lo = &HA5
crcLookupTable(20).Hi = &H56
crcLookupTable(21).Lo = &H2C
crcLookupTable(21).Hi = &H47
crcLookupTable(22).Lo = &HB7
crcLookupTable(22).Hi = &H75
crcLookupTable(23).Lo = &H3E
crcLookupTable(23).Hi = &H64
crcLookupTable(24).Lo = &HC9
crcLookupTable(24).Hi = &H9C
crcLookupTable(25).Lo = &H40
crcLookupTable(25).Hi = &H8D
crcLookupTable(26).Lo = &HDB
crcLookupTable(26).Hi = &HBF
crcLookupTable(27).Lo = &H52
crcLookupTable(27).Hi = &HAE
crcLookupTable(28).Lo = &HED
crcLookupTable(28).Hi = &HDA
crcLookupTable(29).Lo = &H64
crcLookupTable(29).Hi = &HCB
crcLookupTable(30).Lo = &HFF
crcLookupTable(30).Hi = &HF9
crcLookupTable(31).Lo = &H76
crcLookupTable(31).Hi = &HE8
crcLookupTable(32).Lo = &H2
crcLookupTable(32).Hi = &H21
crcLookupTable(33).Lo = &H8B
crcLookupTable(33).Hi = &H30
crcLookupTable(34).Lo = &H10
crcLookupTable(34).Hi = &H2
crcLookupTable(35).Lo = &H99
crcLookupTable(35).Hi = &H13
crcLookupTable(36).Lo = &H26
crcLookupTable(36).Hi = &H67
crcLookupTable(37).Lo = &HAF
crcLookupTable(37).Hi = &H76
crcLookupTable(38).Lo = &H34
crcLookupTable(38).Hi = &H44
crcLookupTable(39).Lo = &HBD
crcLookupTable(39).Hi = &H55
crcLookupTable(40).Lo = &H4A
crcLookupTable(40).Hi = &HAD
crcLookupTable(41).Lo = &HC3
crcLookupTable(41).Hi = &HBC
crcLookupTable(42).Lo = &H58
crcLookupTable(42).Hi = &H8E
crcLookupTable(43).Lo = &HD1
crcLookupTable(43).Hi = &H9F
crcLookupTable(44).Lo = &H6E
crcLookupTable(44).Hi = &HEB
crcLookupTable(45).Lo = &HE7
crcLookupTable(45).Hi = &HFA
crcLookupTable(46).Lo = &H7C
crcLookupTable(46).Hi = &HC8
crcLookupTable(47).Lo = &HF5
crcLookupTable(47).Hi = &HD9
crcLookupTable(48).Lo = &H83
crcLookupTable(48).Hi = &H31
crcLookupTable(49).Lo = &HA
crcLookupTable(49).Hi = &H20
crcLookupTable(50).Lo = &H91
crcLookupTable(50).Hi = &H12
crcLookupTable(51).Lo = &H18
crcLookupTable(51).Hi = &H3
crcLookupTable(52).Lo = &HA7
crcLookupTable(52).Hi = &H77
crcLookupTable(53).Lo = &H2E
crcLookupTable(53).Hi = &H66
crcLookupTable(54).Lo = &HB5
crcLookupTable(54).Hi = &H54
crcLookupTable(55).Lo = &H3C
crcLookupTable(55).Hi = &H45
crcLookupTable(56).Lo = &HCB
crcLookupTable(56).Hi = &HBD
crcLookupTable(57).Lo = &H42
crcLookupTable(57).Hi = &HAC
crcLookupTable(58).Lo = &HD9
crcLookupTable(58).Hi = &H9E
crcLookupTable(59).Lo = &H50
crcLookupTable(59).Hi = &H8F
crcLookupTable(60).Lo = &HEF
crcLookupTable(60).Hi = &HFB
crcLookupTable(61).Lo = &H66
crcLookupTable(61).Hi = &HEA
crcLookupTable(62).Lo = &HFD
crcLookupTable(62).Hi = &HD8
crcLookupTable(63).Lo = &H74
crcLookupTable(63).Hi = &HC9
crcLookupTable(64).Lo = &H4
crcLookupTable(64).Hi = &H42
crcLookupTable(65).Lo = &H8D
crcLookupTable(65).Hi = &H53
crcLookupTable(66).Lo = &H16
crcLookupTable(66).Hi = &H61
crcLookupTable(67).Lo = &H9F
crcLookupTable(67).Hi = &H70
crcLookupTable(68).Lo = &H20
crcLookupTable(68).Hi = &H4
crcLookupTable(69).Lo = &HA9
crcLookupTable(69).Hi = &H15
crcLookupTable(70).Lo = &H32
crcLookupTable(70).Hi = &H27
crcLookupTable(71).Lo = &HBB
crcLookupTable(71).Hi = &H36
crcLookupTable(72).Lo = &H4C
crcLookupTable(72).Hi = &HCE
crcLookupTable(73).Lo = &HC5
crcLookupTable(73).Hi = &HDF
crcLookupTable(74).Lo = &H5E
crcLookupTable(74).Hi = &HED
crcLookupTable(75).Lo = &HD7
crcLookupTable(75).Hi = &HFC
crcLookupTable(76).Lo = &H68
crcLookupTable(76).Hi = &H88
crcLookupTable(77).Lo = &HE1
crcLookupTable(77).Hi = &H99
crcLookupTable(78).Lo = &H7A
crcLookupTable(78).Hi = &HAB
crcLookupTable(79).Lo = &HF3
crcLookupTable(79).Hi = &HBA
crcLookupTable(80).Lo = &H85
crcLookupTable(80).Hi = &H52
crcLookupTable(81).Lo = &HC
crcLookupTable(81).Hi = &H43
crcLookupTable(82).Lo = &H97
crcLookupTable(82).Hi = &H71
crcLookupTable(83).Lo = &H1E
crcLookupTable(83).Hi = &H60
crcLookupTable(84).Lo = &HA1
crcLookupTable(84).Hi = &H14
crcLookupTable(85).Lo = &H28
crcLookupTable(85).Hi = &H5
crcLookupTable(86).Lo = &HB3
crcLookupTable(86).Hi = &H37
crcLookupTable(87).Lo = &H3A
crcLookupTable(87).Hi = &H26
crcLookupTable(88).Lo = &HCD
crcLookupTable(88).Hi = &HDE
crcLookupTable(89).Lo = &H44
crcLookupTable(89).Hi = &HCF
crcLookupTable(90).Lo = &HDF
crcLookupTable(90).Hi = &HFD
crcLookupTable(91).Lo = &H56
crcLookupTable(91).Hi = &HEC
crcLookupTable(92).Lo = &HE9
crcLookupTable(92).Hi = &H98
crcLookupTable(93).Lo = &H60
crcLookupTable(93).Hi = &H89
crcLookupTable(94).Lo = &HFB
crcLookupTable(94).Hi = &HBB
crcLookupTable(95).Lo = &H72
crcLookupTable(95).Hi = &HAA
crcLookupTable(96).Lo = &H6
crcLookupTable(96).Hi = &H63
crcLookupTable(97).Lo = &H8F
crcLookupTable(97).Hi = &H72
crcLookupTable(98).Lo = &H14
crcLookupTable(98).Hi = &H40
crcLookupTable(99).Lo = &H9D
crcLookupTable(99).Hi = &H51
crcLookupTable(100).Lo = &H22
crcLookupTable(100).Hi = &H25
crcLookupTable(101).Lo = &HAB
crcLookupTable(101).Hi = &H34
crcLookupTable(102).Lo = &H30
crcLookupTable(102).Hi = &H6
crcLookupTable(103).Lo = &HB9
crcLookupTable(103).Hi = &H17
crcLookupTable(104).Lo = &H4E
crcLookupTable(104).Hi = &HEF
crcLookupTable(105).Lo = &HC7
crcLookupTable(105).Hi = &HFE
crcLookupTable(106).Lo = &H5C
crcLookupTable(106).Hi = &HCC
crcLookupTable(107).Lo = &HD5
crcLookupTable(107).Hi = &HDD
crcLookupTable(108).Lo = &H6A
crcLookupTable(108).Hi = &HA9
crcLookupTable(109).Lo = &HE3
crcLookupTable(109).Hi = &HB8
crcLookupTable(110).Lo = &H78
crcLookupTable(110).Hi = &H8A
crcLookupTable(111).Lo = &HF1
crcLookupTable(111).Hi = &H9B
crcLookupTable(112).Lo = &H87
crcLookupTable(112).Hi = &H73
crcLookupTable(113).Lo = &HE
crcLookupTable(113).Hi = &H62
crcLookupTable(114).Lo = &H95
crcLookupTable(114).Hi = &H50
crcLookupTable(115).Lo = &H1C
crcLookupTable(115).Hi = &H41
crcLookupTable(116).Lo = &HA3
crcLookupTable(116).Hi = &H35
crcLookupTable(117).Lo = &H2A
crcLookupTable(117).Hi = &H24
crcLookupTable(118).Lo = &HB1
crcLookupTable(118).Hi = &H16
crcLookupTable(119).Lo = &H38
crcLookupTable(119).Hi = &H7
crcLookupTable(120).Lo = &HCF
crcLookupTable(120).Hi = &HFF
crcLookupTable(121).Lo = &H46
crcLookupTable(121).Hi = &HEE
crcLookupTable(122).Lo = &HDD
crcLookupTable(122).Hi = &HDC
crcLookupTable(123).Lo = &H54
crcLookupTable(123).Hi = &HCD
crcLookupTable(124).Lo = &HEB
crcLookupTable(124).Hi = &HB9
crcLookupTable(125).Lo = &H62
crcLookupTable(125).Hi = &HA8
crcLookupTable(126).Lo = &HF9
crcLookupTable(126).Hi = &H9A
crcLookupTable(127).Lo = &H70
crcLookupTable(127).Hi = &H8B
crcLookupTable(128).Lo = &H8
crcLookupTable(128).Hi = &H84
crcLookupTable(129).Lo = &H81
crcLookupTable(129).Hi = &H95
crcLookupTable(130).Lo = &H1A
crcLookupTable(130).Hi = &HA7
crcLookupTable(131).Lo = &H93
crcLookupTable(131).Hi = &HB6
crcLookupTable(132).Lo = &H2C
crcLookupTable(132).Hi = &HC2
crcLookupTable(133).Lo = &HA5
crcLookupTable(133).Hi = &HD3
crcLookupTable(134).Lo = &H3E
crcLookupTable(134).Hi = &HE1
crcLookupTable(135).Lo = &HB7
crcLookupTable(135).Hi = &HF0
crcLookupTable(136).Lo = &H40
crcLookupTable(136).Hi = &H8
crcLookupTable(137).Lo = &HC9
crcLookupTable(137).Hi = &H19
crcLookupTable(138).Lo = &H52
crcLookupTable(138).Hi = &H2B
crcLookupTable(139).Lo = &HDB
crcLookupTable(139).Hi = &H3A
crcLookupTable(140).Lo = &H64
crcLookupTable(140).Hi = &H4E
crcLookupTable(141).Lo = &HED
crcLookupTable(141).Hi = &H5F
crcLookupTable(142).Lo = &H76
crcLookupTable(142).Hi = &H6D
crcLookupTable(143).Lo = &HFF
crcLookupTable(143).Hi = &H7C
crcLookupTable(144).Lo = &H89
crcLookupTable(144).Hi = &H94
crcLookupTable(145).Lo = &H0
crcLookupTable(145).Hi = &H85
crcLookupTable(146).Lo = &H9B
crcLookupTable(146).Hi = &HB7
crcLookupTable(147).Lo = &H12
crcLookupTable(147).Hi = &HA6
crcLookupTable(148).Lo = &HAD
crcLookupTable(148).Hi = &HD2
crcLookupTable(149).Lo = &H24
crcLookupTable(149).Hi = &HC3
crcLookupTable(150).Lo = &HBF
crcLookupTable(150).Hi = &HF1
crcLookupTable(151).Lo = &H36
crcLookupTable(151).Hi = &HE0
crcLookupTable(152).Lo = &HC1
crcLookupTable(152).Hi = &H18
crcLookupTable(153).Lo = &H48
crcLookupTable(153).Hi = &H9
crcLookupTable(154).Lo = &HD3
crcLookupTable(154).Hi = &H3B
crcLookupTable(155).Lo = &H5A
crcLookupTable(155).Hi = &H2A
crcLookupTable(156).Lo = &HE5
crcLookupTable(156).Hi = &H5E
crcLookupTable(157).Lo = &H6C
crcLookupTable(157).Hi = &H4F
crcLookupTable(158).Lo = &HF7
crcLookupTable(158).Hi = &H7D
crcLookupTable(159).Lo = &H7E
crcLookupTable(159).Hi = &H6C
crcLookupTable(160).Lo = &HA
crcLookupTable(160).Hi = &HA5
crcLookupTable(161).Lo = &H83
crcLookupTable(161).Hi = &HB4
crcLookupTable(162).Lo = &H18
crcLookupTable(162).Hi = &H86
crcLookupTable(163).Lo = &H91
crcLookupTable(163).Hi = &H97
crcLookupTable(164).Lo = &H2E
crcLookupTable(164).Hi = &HE3
crcLookupTable(165).Lo = &HA7
crcLookupTable(165).Hi = &HF2
crcLookupTable(166).Lo = &H3C
crcLookupTable(166).Hi = &HC0
crcLookupTable(167).Lo = &HB5
crcLookupTable(167).Hi = &HD1
crcLookupTable(168).Lo = &H42
crcLookupTable(168).Hi = &H29
crcLookupTable(169).Lo = &HCB
crcLookupTable(169).Hi = &H38
crcLookupTable(170).Lo = &H50
crcLookupTable(170).Hi = &HA
crcLookupTable(171).Lo = &HD9
crcLookupTable(171).Hi = &H1B
crcLookupTable(172).Lo = &H66
crcLookupTable(172).Hi = &H6F
crcLookupTable(173).Lo = &HEF
crcLookupTable(173).Hi = &H7E
crcLookupTable(174).Lo = &H74
crcLookupTable(174).Hi = &H4C
crcLookupTable(175).Lo = &HFD
crcLookupTable(175).Hi = &H5D
crcLookupTable(176).Lo = &H8B
crcLookupTable(176).Hi = &HB5
crcLookupTable(177).Lo = &H2
crcLookupTable(177).Hi = &HA4
crcLookupTable(178).Lo = &H99
crcLookupTable(178).Hi = &H96
crcLookupTable(179).Lo = &H10
crcLookupTable(179).Hi = &H87
crcLookupTable(180).Lo = &HAF
crcLookupTable(180).Hi = &HF3
crcLookupTable(181).Lo = &H26
crcLookupTable(181).Hi = &HE2
crcLookupTable(182).Lo = &HBD
crcLookupTable(182).Hi = &HD0
crcLookupTable(183).Lo = &H34
crcLookupTable(183).Hi = &HC1
crcLookupTable(184).Lo = &HC3
crcLookupTable(184).Hi = &H39
crcLookupTable(185).Lo = &H4A
crcLookupTable(185).Hi = &H28
crcLookupTable(186).Lo = &HD1
crcLookupTable(186).Hi = &H1A
crcLookupTable(187).Lo = &H58
crcLookupTable(187).Hi = &HB
crcLookupTable(188).Lo = &HE7
crcLookupTable(188).Hi = &H7F
crcLookupTable(189).Lo = &H6E
crcLookupTable(189).Hi = &H6E
crcLookupTable(190).Lo = &HF5
crcLookupTable(190).Hi = &H5C
crcLookupTable(191).Lo = &H7C
crcLookupTable(191).Hi = &H4D
crcLookupTable(192).Lo = &HC
crcLookupTable(192).Hi = &HC6
crcLookupTable(193).Lo = &H85
crcLookupTable(193).Hi = &HD7
crcLookupTable(194).Lo = &H1E
crcLookupTable(194).Hi = &HE5
crcLookupTable(195).Lo = &H97
crcLookupTable(195).Hi = &HF4
crcLookupTable(196).Lo = &H28
crcLookupTable(196).Hi = &H80
crcLookupTable(197).Lo = &HA1
crcLookupTable(197).Hi = &H91
crcLookupTable(198).Lo = &H3A
crcLookupTable(198).Hi = &HA3
crcLookupTable(199).Lo = &HB3
crcLookupTable(199).Hi = &HB2
crcLookupTable(200).Lo = &H44
crcLookupTable(200).Hi = &H4A
crcLookupTable(201).Lo = &HCD
crcLookupTable(201).Hi = &H5B
crcLookupTable(202).Lo = &H56
crcLookupTable(202).Hi = &H69
crcLookupTable(203).Lo = &HDF
crcLookupTable(203).Hi = &H78
crcLookupTable(204).Lo = &H60
crcLookupTable(204).Hi = &HC
crcLookupTable(205).Lo = &HE9
crcLookupTable(205).Hi = &H1D
crcLookupTable(206).Lo = &H72
crcLookupTable(206).Hi = &H2F
crcLookupTable(207).Lo = &HFB
crcLookupTable(207).Hi = &H3E
crcLookupTable(208).Lo = &H8D
crcLookupTable(208).Hi = &HD6
crcLookupTable(209).Lo = &H4
crcLookupTable(209).Hi = &HC7
crcLookupTable(210).Lo = &H9F
crcLookupTable(210).Hi = &HF5
crcLookupTable(211).Lo = &H16
crcLookupTable(211).Hi = &HE4
crcLookupTable(212).Lo = &HA9
crcLookupTable(212).Hi = &H90
crcLookupTable(213).Lo = &H20
crcLookupTable(213).Hi = &H81
crcLookupTable(214).Lo = &HBB
crcLookupTable(214).Hi = &HB3
crcLookupTable(215).Lo = &H32
crcLookupTable(215).Hi = &HA2
crcLookupTable(216).Lo = &HC5
crcLookupTable(216).Hi = &H5A
crcLookupTable(217).Lo = &H4C
crcLookupTable(217).Hi = &H4B
crcLookupTable(218).Lo = &HD7
crcLookupTable(218).Hi = &H79
crcLookupTable(219).Lo = &H5E
crcLookupTable(219).Hi = &H68
crcLookupTable(220).Lo = &HE1
crcLookupTable(220).Hi = &H1C
crcLookupTable(221).Lo = &H68
crcLookupTable(221).Hi = &HD
crcLookupTable(222).Lo = &HF3
crcLookupTable(222).Hi = &H3F
crcLookupTable(223).Lo = &H7A
crcLookupTable(223).Hi = &H2E
crcLookupTable(224).Lo = &HE
crcLookupTable(224).Hi = &HE7
crcLookupTable(225).Lo = &H87
crcLookupTable(225).Hi = &HF6
crcLookupTable(226).Lo = &H1C
crcLookupTable(226).Hi = &HC4
crcLookupTable(227).Lo = &H95
crcLookupTable(227).Hi = &HD5
crcLookupTable(228).Lo = &H2A
crcLookupTable(228).Hi = &HA1
crcLookupTable(229).Lo = &HA3
crcLookupTable(229).Hi = &HB0
crcLookupTable(230).Lo = &H38
crcLookupTable(230).Hi = &H82
crcLookupTable(231).Lo = &HB1
crcLookupTable(231).Hi = &H93
crcLookupTable(232).Lo = &H46
crcLookupTable(232).Hi = &H6B
crcLookupTable(233).Lo = &HCF
crcLookupTable(233).Hi = &H7A
crcLookupTable(234).Lo = &H54
crcLookupTable(234).Hi = &H48
crcLookupTable(235).Lo = &HDD
crcLookupTable(235).Hi = &H59
crcLookupTable(236).Lo = &H62
crcLookupTable(236).Hi = &H2D
crcLookupTable(237).Lo = &HEB
crcLookupTable(237).Hi = &H3C
crcLookupTable(238).Lo = &H70
crcLookupTable(238).Hi = &HE
crcLookupTable(239).Lo = &HF9
crcLookupTable(239).Hi = &H1F
crcLookupTable(240).Lo = &H8F
crcLookupTable(240).Hi = &HF7
crcLookupTable(241).Lo = &H6
crcLookupTable(241).Hi = &HE6
crcLookupTable(242).Lo = &H9D
crcLookupTable(242).Hi = &HD4
crcLookupTable(243).Lo = &H14
crcLookupTable(243).Hi = &HC5
crcLookupTable(244).Lo = &HAB
crcLookupTable(244).Hi = &HB1
crcLookupTable(245).Lo = &H22
crcLookupTable(245).Hi = &HA0
crcLookupTable(246).Lo = &HB9
crcLookupTable(246).Hi = &H92
crcLookupTable(247).Lo = &H30
crcLookupTable(247).Hi = &H83
crcLookupTable(248).Lo = &HC7
crcLookupTable(248).Hi = &H7B
crcLookupTable(249).Lo = &H4E
crcLookupTable(249).Hi = &H6A
crcLookupTable(250).Lo = &HD5
crcLookupTable(250).Hi = &H58
crcLookupTable(251).Lo = &H5C
crcLookupTable(251).Hi = &H49
crcLookupTable(252).Lo = &HE3
crcLookupTable(252).Hi = &H3D
crcLookupTable(253).Lo = &H6A
crcLookupTable(253).Hi = &H2C
crcLookupTable(254).Lo = &HF1
crcLookupTable(254).Hi = &H1E
crcLookupTable(255).Lo = &H78
crcLookupTable(255).Hi = &HF
Dim crcLookupTable(256) As WORD
'This function returns the CRC of the array at data for length positions
Private Function Get_Crc(ByRef data() As Byte, ByVal length As Short) As WORD
Dim Index As Short
Dim Table_Index As Short
Dim newCrc As WORD
newCrc.Lo = &HFF
newCrc.Hi = &HFF
For Index = 0 To length - 1
'exclusive-or the input byte with the low-order byte of the CRC register
'to get an index into crcLookupTable
Table_Index = newCrc.Lo Xor data(Index)
'shift the CRC register eight bits to the right
newCrc.Lo = newCrc.Hi
newCrc.Hi = 0
' exclusive-or the CRC register with the contents of Table at Table_Index
newCrc.Lo = newCrc.Lo Xor crcLookupTable(Table_Index).Lo
newCrc.Hi = newCrc.Hi Xor crcLookupTable(Table_Index).Hi
Next Index
'Invert & return newCrc
Get_Crc.Lo = newCrc.Lo Xor &HFF
Get_Crc.Hi = newCrc.Hi Xor &HFF
End Function
Private Structure WORD
Dim Lo As Byte
Dim Hi As Byte
End Structure
Private Sub Initialize_CRC_Lookup_Table()
crcLookupTable(0).Lo = &H0
crcLookupTable(0).Hi = &H0
crcLookupTable(1).Lo = &H89
crcLookupTable(1).Hi = &H11
crcLookupTable(2).Lo = &H12
crcLookupTable(2).Hi = &H23
crcLookupTable(3).Lo = &H9B
crcLookupTable(3).Hi = &H32
crcLookupTable(4).Lo = &H24
crcLookupTable(4).Hi = &H46
crcLookupTable(5).Lo = &HAD
crcLookupTable(5).Hi = &H57
crcLookupTable(6).Lo = &H36
crcLookupTable(6).Hi = &H65
crcLookupTable(7).Lo = &HBF
crcLookupTable(7).Hi = &H74
crcLookupTable(8).Lo = &H48
crcLookupTable(8).Hi = &H8C
crcLookupTable(9).Lo = &HC1
crcLookupTable(9).Hi = &H9D
crcLookupTable(10).Lo = &H5A
crcLookupTable(10).Hi = &HAF
crcLookupTable(11).Lo = &HD3
crcLookupTable(11).Hi = &HBE
crcLookupTable(12).Lo = &H6C
crcLookupTable(12).Hi = &HCA
crcLookupTable(13).Lo = &HE5
crcLookupTable(13).Hi = &HDB
crcLookupTable(14).Lo = &H7E
crcLookupTable(14).Hi = &HE9
crcLookupTable(15).Lo = &HF7
crcLookupTable(15).Hi = &HF8
crcLookupTable(16).Lo = &H81
crcLookupTable(16).Hi = &H10
crcLookupTable(17).Lo = &H8
crcLookupTable(17).Hi = &H1
crcLookupTable(18).Lo = &H93
crcLookupTable(18).Hi = &H33
crcLookupTable(19).Lo = &H1A
crcLookupTable(19).Hi = &H22
crcLookupTable(20).Lo = &HA5
crcLookupTable(20).Hi = &H56
crcLookupTable(21).Lo = &H2C
crcLookupTable(21).Hi = &H47
crcLookupTable(22).Lo = &HB7
crcLookupTable(22).Hi = &H75
crcLookupTable(23).Lo = &H3E
crcLookupTable(23).Hi = &H64
crcLookupTable(24).Lo = &HC9
crcLookupTable(24).Hi = &H9C
crcLookupTable(25).Lo = &H40
crcLookupTable(25).Hi = &H8D
crcLookupTable(26).Lo = &HDB
crcLookupTable(26).Hi = &HBF
crcLookupTable(27).Lo = &H52
crcLookupTable(27).Hi = &HAE
crcLookupTable(28).Lo = &HED
crcLookupTable(28).Hi = &HDA
crcLookupTable(29).Lo = &H64
crcLookupTable(29).Hi = &HCB
crcLookupTable(30).Lo = &HFF
crcLookupTable(30).Hi = &HF9
crcLookupTable(31).Lo = &H76
crcLookupTable(31).Hi = &HE8
crcLookupTable(32).Lo = &H2
crcLookupTable(32).Hi = &H21
crcLookupTable(33).Lo = &H8B
crcLookupTable(33).Hi = &H30
crcLookupTable(34).Lo = &H10
crcLookupTable(34).Hi = &H2
crcLookupTable(35).Lo = &H99
crcLookupTable(35).Hi = &H13
crcLookupTable(36).Lo = &H26
crcLookupTable(36).Hi = &H67
crcLookupTable(37).Lo = &HAF
crcLookupTable(37).Hi = &H76
crcLookupTable(38).Lo = &H34
crcLookupTable(38).Hi = &H44
crcLookupTable(39).Lo = &HBD
crcLookupTable(39).Hi = &H55
crcLookupTable(40).Lo = &H4A
crcLookupTable(40).Hi = &HAD
crcLookupTable(41).Lo = &HC3
crcLookupTable(41).Hi = &HBC
crcLookupTable(42).Lo = &H58
crcLookupTable(42).Hi = &H8E
crcLookupTable(43).Lo = &HD1
crcLookupTable(43).Hi = &H9F
crcLookupTable(44).Lo = &H6E
crcLookupTable(44).Hi = &HEB
crcLookupTable(45).Lo = &HE7
crcLookupTable(45).Hi = &HFA
crcLookupTable(46).Lo = &H7C
crcLookupTable(46).Hi = &HC8
crcLookupTable(47).Lo = &HF5
crcLookupTable(47).Hi = &HD9
crcLookupTable(48).Lo = &H83
crcLookupTable(48).Hi = &H31
crcLookupTable(49).Lo = &HA
crcLookupTable(49).Hi = &H20
crcLookupTable(50).Lo = &H91
crcLookupTable(50).Hi = &H12
crcLookupTable(51).Lo = &H18
crcLookupTable(51).Hi = &H3
crcLookupTable(52).Lo = &HA7
crcLookupTable(52).Hi = &H77
crcLookupTable(53).Lo = &H2E
crcLookupTable(53).Hi = &H66
crcLookupTable(54).Lo = &HB5
crcLookupTable(54).Hi = &H54
crcLookupTable(55).Lo = &H3C
crcLookupTable(55).Hi = &H45
crcLookupTable(56).Lo = &HCB
crcLookupTable(56).Hi = &HBD
crcLookupTable(57).Lo = &H42
crcLookupTable(57).Hi = &HAC
crcLookupTable(58).Lo = &HD9
crcLookupTable(58).Hi = &H9E
crcLookupTable(59).Lo = &H50
crcLookupTable(59).Hi = &H8F
crcLookupTable(60).Lo = &HEF
crcLookupTable(60).Hi = &HFB
crcLookupTable(61).Lo = &H66
crcLookupTable(61).Hi = &HEA
crcLookupTable(62).Lo = &HFD
crcLookupTable(62).Hi = &HD8
crcLookupTable(63).Lo = &H74
crcLookupTable(63).Hi = &HC9
crcLookupTable(64).Lo = &H4
crcLookupTable(64).Hi = &H42
crcLookupTable(65).Lo = &H8D
crcLookupTable(65).Hi = &H53
crcLookupTable(66).Lo = &H16
crcLookupTable(66).Hi = &H61
crcLookupTable(67).Lo = &H9F
crcLookupTable(67).Hi = &H70
crcLookupTable(68).Lo = &H20
crcLookupTable(68).Hi = &H4
crcLookupTable(69).Lo = &HA9
crcLookupTable(69).Hi = &H15
crcLookupTable(70).Lo = &H32
crcLookupTable(70).Hi = &H27
crcLookupTable(71).Lo = &HBB
crcLookupTable(71).Hi = &H36
crcLookupTable(72).Lo = &H4C
crcLookupTable(72).Hi = &HCE
crcLookupTable(73).Lo = &HC5
crcLookupTable(73).Hi = &HDF
crcLookupTable(74).Lo = &H5E
crcLookupTable(74).Hi = &HED
crcLookupTable(75).Lo = &HD7
crcLookupTable(75).Hi = &HFC
crcLookupTable(76).Lo = &H68
crcLookupTable(76).Hi = &H88
crcLookupTable(77).Lo = &HE1
crcLookupTable(77).Hi = &H99
crcLookupTable(78).Lo = &H7A
crcLookupTable(78).Hi = &HAB
crcLookupTable(79).Lo = &HF3
crcLookupTable(79).Hi = &HBA
crcLookupTable(80).Lo = &H85
crcLookupTable(80).Hi = &H52
crcLookupTable(81).Lo = &HC
crcLookupTable(81).Hi = &H43
crcLookupTable(82).Lo = &H97
crcLookupTable(82).Hi = &H71
crcLookupTable(83).Lo = &H1E
crcLookupTable(83).Hi = &H60
crcLookupTable(84).Lo = &HA1
crcLookupTable(84).Hi = &H14
crcLookupTable(85).Lo = &H28
crcLookupTable(85).Hi = &H5
crcLookupTable(86).Lo = &HB3
crcLookupTable(86).Hi = &H37
crcLookupTable(87).Lo = &H3A
crcLookupTable(87).Hi = &H26
crcLookupTable(88).Lo = &HCD
crcLookupTable(88).Hi = &HDE
crcLookupTable(89).Lo = &H44
crcLookupTable(89).Hi = &HCF
crcLookupTable(90).Lo = &HDF
crcLookupTable(90).Hi = &HFD
crcLookupTable(91).Lo = &H56
crcLookupTable(91).Hi = &HEC
crcLookupTable(92).Lo = &HE9
crcLookupTable(92).Hi = &H98
crcLookupTable(93).Lo = &H60
crcLookupTable(93).Hi = &H89
crcLookupTable(94).Lo = &HFB
crcLookupTable(94).Hi = &HBB
crcLookupTable(95).Lo = &H72
crcLookupTable(95).Hi = &HAA
crcLookupTable(96).Lo = &H6
crcLookupTable(96).Hi = &H63
crcLookupTable(97).Lo = &H8F
crcLookupTable(97).Hi = &H72
crcLookupTable(98).Lo = &H14
crcLookupTable(98).Hi = &H40
crcLookupTable(99).Lo = &H9D
crcLookupTable(99).Hi = &H51
crcLookupTable(100).Lo = &H22
crcLookupTable(100).Hi = &H25
crcLookupTable(101).Lo = &HAB
crcLookupTable(101).Hi = &H34
crcLookupTable(102).Lo = &H30
crcLookupTable(102).Hi = &H6
crcLookupTable(103).Lo = &HB9
crcLookupTable(103).Hi = &H17
crcLookupTable(104).Lo = &H4E
crcLookupTable(104).Hi = &HEF
crcLookupTable(105).Lo = &HC7
crcLookupTable(105).Hi = &HFE
crcLookupTable(106).Lo = &H5C
crcLookupTable(106).Hi = &HCC
crcLookupTable(107).Lo = &HD5
crcLookupTable(107).Hi = &HDD
crcLookupTable(108).Lo = &H6A
crcLookupTable(108).Hi = &HA9
crcLookupTable(109).Lo = &HE3
crcLookupTable(109).Hi = &HB8
crcLookupTable(110).Lo = &H78
crcLookupTable(110).Hi = &H8A
crcLookupTable(111).Lo = &HF1
crcLookupTable(111).Hi = &H9B
crcLookupTable(112).Lo = &H87
crcLookupTable(112).Hi = &H73
crcLookupTable(113).Lo = &HE
crcLookupTable(113).Hi = &H62
crcLookupTable(114).Lo = &H95
crcLookupTable(114).Hi = &H50
crcLookupTable(115).Lo = &H1C
crcLookupTable(115).Hi = &H41
crcLookupTable(116).Lo = &HA3
crcLookupTable(116).Hi = &H35
crcLookupTable(117).Lo = &H2A
crcLookupTable(117).Hi = &H24
crcLookupTable(118).Lo = &HB1
crcLookupTable(118).Hi = &H16
crcLookupTable(119).Lo = &H38
crcLookupTable(119).Hi = &H7
crcLookupTable(120).Lo = &HCF
crcLookupTable(120).Hi = &HFF
crcLookupTable(121).Lo = &H46
crcLookupTable(121).Hi = &HEE
crcLookupTable(122).Lo = &HDD
crcLookupTable(122).Hi = &HDC
crcLookupTable(123).Lo = &H54
crcLookupTable(123).Hi = &HCD
crcLookupTable(124).Lo = &HEB
crcLookupTable(124).Hi = &HB9
crcLookupTable(125).Lo = &H62
crcLookupTable(125).Hi = &HA8
crcLookupTable(126).Lo = &HF9
crcLookupTable(126).Hi = &H9A
crcLookupTable(127).Lo = &H70
crcLookupTable(127).Hi = &H8B
crcLookupTable(128).Lo = &H8
crcLookupTable(128).Hi = &H84
crcLookupTable(129).Lo = &H81
crcLookupTable(129).Hi = &H95
crcLookupTable(130).Lo = &H1A
crcLookupTable(130).Hi = &HA7
crcLookupTable(131).Lo = &H93
crcLookupTable(131).Hi = &HB6
crcLookupTable(132).Lo = &H2C
crcLookupTable(132).Hi = &HC2
crcLookupTable(133).Lo = &HA5
crcLookupTable(133).Hi = &HD3
crcLookupTable(134).Lo = &H3E
crcLookupTable(134).Hi = &HE1
crcLookupTable(135).Lo = &HB7
crcLookupTable(135).Hi = &HF0
crcLookupTable(136).Lo = &H40
crcLookupTable(136).Hi = &H8
crcLookupTable(137).Lo = &HC9
crcLookupTable(137).Hi = &H19
crcLookupTable(138).Lo = &H52
crcLookupTable(138).Hi = &H2B
crcLookupTable(139).Lo = &HDB
crcLookupTable(139).Hi = &H3A
crcLookupTable(140).Lo = &H64
crcLookupTable(140).Hi = &H4E
crcLookupTable(141).Lo = &HED
crcLookupTable(141).Hi = &H5F
crcLookupTable(142).Lo = &H76
crcLookupTable(142).Hi = &H6D
crcLookupTable(143).Lo = &HFF
crcLookupTable(143).Hi = &H7C
crcLookupTable(144).Lo = &H89
crcLookupTable(144).Hi = &H94
crcLookupTable(145).Lo = &H0
crcLookupTable(145).Hi = &H85
crcLookupTable(146).Lo = &H9B
crcLookupTable(146).Hi = &HB7
crcLookupTable(147).Lo = &H12
crcLookupTable(147).Hi = &HA6
crcLookupTable(148).Lo = &HAD
crcLookupTable(148).Hi = &HD2
crcLookupTable(149).Lo = &H24
crcLookupTable(149).Hi = &HC3
crcLookupTable(150).Lo = &HBF
crcLookupTable(150).Hi = &HF1
crcLookupTable(151).Lo = &H36
crcLookupTable(151).Hi = &HE0
crcLookupTable(152).Lo = &HC1
crcLookupTable(152).Hi = &H18
crcLookupTable(153).Lo = &H48
crcLookupTable(153).Hi = &H9
crcLookupTable(154).Lo = &HD3
crcLookupTable(154).Hi = &H3B
crcLookupTable(155).Lo = &H5A
crcLookupTable(155).Hi = &H2A
crcLookupTable(156).Lo = &HE5
crcLookupTable(156).Hi = &H5E
crcLookupTable(157).Lo = &H6C
crcLookupTable(157).Hi = &H4F
crcLookupTable(158).Lo = &HF7
crcLookupTable(158).Hi = &H7D
crcLookupTable(159).Lo = &H7E
crcLookupTable(159).Hi = &H6C
crcLookupTable(160).Lo = &HA
crcLookupTable(160).Hi = &HA5
crcLookupTable(161).Lo = &H83
crcLookupTable(161).Hi = &HB4
crcLookupTable(162).Lo = &H18
crcLookupTable(162).Hi = &H86
crcLookupTable(163).Lo = &H91
crcLookupTable(163).Hi = &H97
crcLookupTable(164).Lo = &H2E
crcLookupTable(164).Hi = &HE3
crcLookupTable(165).Lo = &HA7
crcLookupTable(165).Hi = &HF2
crcLookupTable(166).Lo = &H3C
crcLookupTable(166).Hi = &HC0
crcLookupTable(167).Lo = &HB5
crcLookupTable(167).Hi = &HD1
crcLookupTable(168).Lo = &H42
crcLookupTable(168).Hi = &H29
crcLookupTable(169).Lo = &HCB
crcLookupTable(169).Hi = &H38
crcLookupTable(170).Lo = &H50
crcLookupTable(170).Hi = &HA
crcLookupTable(171).Lo = &HD9
crcLookupTable(171).Hi = &H1B
crcLookupTable(172).Lo = &H66
crcLookupTable(172).Hi = &H6F
crcLookupTable(173).Lo = &HEF
crcLookupTable(173).Hi = &H7E
crcLookupTable(174).Lo = &H74
crcLookupTable(174).Hi = &H4C
crcLookupTable(175).Lo = &HFD
crcLookupTable(175).Hi = &H5D
crcLookupTable(176).Lo = &H8B
crcLookupTable(176).Hi = &HB5
crcLookupTable(177).Lo = &H2
crcLookupTable(177).Hi = &HA4
crcLookupTable(178).Lo = &H99
crcLookupTable(178).Hi = &H96
crcLookupTable(179).Lo = &H10
crcLookupTable(179).Hi = &H87
crcLookupTable(180).Lo = &HAF
crcLookupTable(180).Hi = &HF3
crcLookupTable(181).Lo = &H26
crcLookupTable(181).Hi = &HE2
crcLookupTable(182).Lo = &HBD
crcLookupTable(182).Hi = &HD0
crcLookupTable(183).Lo = &H34
crcLookupTable(183).Hi = &HC1
crcLookupTable(184).Lo = &HC3
crcLookupTable(184).Hi = &H39
crcLookupTable(185).Lo = &H4A
crcLookupTable(185).Hi = &H28
crcLookupTable(186).Lo = &HD1
crcLookupTable(186).Hi = &H1A
crcLookupTable(187).Lo = &H58
crcLookupTable(187).Hi = &HB
crcLookupTable(188).Lo = &HE7
crcLookupTable(188).Hi = &H7F
crcLookupTable(189).Lo = &H6E
crcLookupTable(189).Hi = &H6E
crcLookupTable(190).Lo = &HF5
crcLookupTable(190).Hi = &H5C
crcLookupTable(191).Lo = &H7C
crcLookupTable(191).Hi = &H4D
crcLookupTable(192).Lo = &HC
crcLookupTable(192).Hi = &HC6
crcLookupTable(193).Lo = &H85
crcLookupTable(193).Hi = &HD7
crcLookupTable(194).Lo = &H1E
crcLookupTable(194).Hi = &HE5
crcLookupTable(195).Lo = &H97
crcLookupTable(195).Hi = &HF4
crcLookupTable(196).Lo = &H28
crcLookupTable(196).Hi = &H80
crcLookupTable(197).Lo = &HA1
crcLookupTable(197).Hi = &H91
crcLookupTable(198).Lo = &H3A
crcLookupTable(198).Hi = &HA3
crcLookupTable(199).Lo = &HB3
crcLookupTable(199).Hi = &HB2
crcLookupTable(200).Lo = &H44
crcLookupTable(200).Hi = &H4A
crcLookupTable(201).Lo = &HCD
crcLookupTable(201).Hi = &H5B
crcLookupTable(202).Lo = &H56
crcLookupTable(202).Hi = &H69
crcLookupTable(203).Lo = &HDF
crcLookupTable(203).Hi = &H78
crcLookupTable(204).Lo = &H60
crcLookupTable(204).Hi = &HC
crcLookupTable(205).Lo = &HE9
crcLookupTable(205).Hi = &H1D
crcLookupTable(206).Lo = &H72
crcLookupTable(206).Hi = &H2F
crcLookupTable(207).Lo = &HFB
crcLookupTable(207).Hi = &H3E
crcLookupTable(208).Lo = &H8D
crcLookupTable(208).Hi = &HD6
crcLookupTable(209).Lo = &H4
crcLookupTable(209).Hi = &HC7
crcLookupTable(210).Lo = &H9F
crcLookupTable(210).Hi = &HF5
crcLookupTable(211).Lo = &H16
crcLookupTable(211).Hi = &HE4
crcLookupTable(212).Lo = &HA9
crcLookupTable(212).Hi = &H90
crcLookupTable(213).Lo = &H20
crcLookupTable(213).Hi = &H81
crcLookupTable(214).Lo = &HBB
crcLookupTable(214).Hi = &HB3
crcLookupTable(215).Lo = &H32
crcLookupTable(215).Hi = &HA2
crcLookupTable(216).Lo = &HC5
crcLookupTable(216).Hi = &H5A
crcLookupTable(217).Lo = &H4C
crcLookupTable(217).Hi = &H4B
crcLookupTable(218).Lo = &HD7
crcLookupTable(218).Hi = &H79
crcLookupTable(219).Lo = &H5E
crcLookupTable(219).Hi = &H68
crcLookupTable(220).Lo = &HE1
crcLookupTable(220).Hi = &H1C
crcLookupTable(221).Lo = &H68
crcLookupTable(221).Hi = &HD
crcLookupTable(222).Lo = &HF3
crcLookupTable(222).Hi = &H3F
crcLookupTable(223).Lo = &H7A
crcLookupTable(223).Hi = &H2E
crcLookupTable(224).Lo = &HE
crcLookupTable(224).Hi = &HE7
crcLookupTable(225).Lo = &H87
crcLookupTable(225).Hi = &HF6
crcLookupTable(226).Lo = &H1C
crcLookupTable(226).Hi = &HC4
crcLookupTable(227).Lo = &H95
crcLookupTable(227).Hi = &HD5
crcLookupTable(228).Lo = &H2A
crcLookupTable(228).Hi = &HA1
crcLookupTable(229).Lo = &HA3
crcLookupTable(229).Hi = &HB0
crcLookupTable(230).Lo = &H38
crcLookupTable(230).Hi = &H82
crcLookupTable(231).Lo = &HB1
crcLookupTable(231).Hi = &H93
crcLookupTable(232).Lo = &H46
crcLookupTable(232).Hi = &H6B
crcLookupTable(233).Lo = &HCF
crcLookupTable(233).Hi = &H7A
crcLookupTable(234).Lo = &H54
crcLookupTable(234).Hi = &H48
crcLookupTable(235).Lo = &HDD
crcLookupTable(235).Hi = &H59
crcLookupTable(236).Lo = &H62
crcLookupTable(236).Hi = &H2D
crcLookupTable(237).Lo = &HEB
crcLookupTable(237).Hi = &H3C
crcLookupTable(238).Lo = &H70
crcLookupTable(238).Hi = &HE
crcLookupTable(239).Lo = &HF9
crcLookupTable(239).Hi = &H1F
crcLookupTable(240).Lo = &H8F
crcLookupTable(240).Hi = &HF7
crcLookupTable(241).Lo = &H6
crcLookupTable(241).Hi = &HE6
crcLookupTable(242).Lo = &H9D
crcLookupTable(242).Hi = &HD4
crcLookupTable(243).Lo = &H14
crcLookupTable(243).Hi = &HC5
crcLookupTable(244).Lo = &HAB
crcLookupTable(244).Hi = &HB1
crcLookupTable(245).Lo = &H22
crcLookupTable(245).Hi = &HA0
crcLookupTable(246).Lo = &HB9
crcLookupTable(246).Hi = &H92
crcLookupTable(247).Lo = &H30
crcLookupTable(247).Hi = &H83
crcLookupTable(248).Lo = &HC7
crcLookupTable(248).Hi = &H7B
crcLookupTable(249).Lo = &H4E
crcLookupTable(249).Hi = &H6A
crcLookupTable(250).Lo = &HD5
crcLookupTable(250).Hi = &H58
crcLookupTable(251).Lo = &H5C
crcLookupTable(251).Hi = &H49
crcLookupTable(252).Lo = &HE3
crcLookupTable(252).Hi = &H3D
crcLookupTable(253).Lo = &H6A
crcLookupTable(253).Hi = &H2C
crcLookupTable(254).Lo = &HF1
crcLookupTable(254).Hi = &H1E
crcLookupTable(255).Lo = &H78
crcLookupTable(255).Hi = &HF
End Sub
Dim Index As Integer
Dim Table_Index As Integer
Dim Index As Short[FONT=monospace]
[/FONT]Dim Table_Index As Short
Did you declare theI added a Initialize_CRC_Lookup_Table() in the top part of code before anything else is done but still no luck
Dim foo(20) as byte
Dim foo(0 to 19) as byte
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If sp.IsOpen = False Then
sp.PortName = "COM1"
sp.Open()
End If
Initialize_CRC_Lookup_Table()
Dim crc As WORD
Dim blob(0 To 21) As Byte 'array correct size now!
blob(0) = 31 ' Command #31 from LCD Data Sheet (Send Data To LCD)
blob(1) = 18 ' 18 Bytes of packet data
blob(2) = 0 ' Write Starts at column #0 (Far Left)
blob(3) = 0 ' Write Starts at row #0 (Top Row)
blob(4) = Asc("H")
blob(5) = Asc("e")
blob(6) = Asc("f")
blob(7) = Asc("f")
blob(8) = Asc("o")
blob(9) = Asc(" ")
blob(10) = Asc("R")
blob(11) = Asc("u")
blob(12) = Asc("l")
blob(13) = Asc("e")
blob(14) = Asc("s")
blob(15) = Asc("!")
blob(16) = Asc("!")
blob(17) = Asc(" ")
blob(18) = Asc(" ")
blob(19) = Asc(" ")
crc = Get_Crc(blob, blob.Length - 2)
MessageBox.Show(crc.Lo & crc.Hi)
blob(20) = crc.Lo
blob(21) = crc.Hi
sp.Write(blob, 0, blob.Length)
End Sub
The Windoze API call that is used in C/C++ apps is:... you mentioned purging it because of the massive 4000 byte array. How do you do that?
[FONT=Arial][COLOR=#008000][B]Public Constructors[/B]
[U]SerialPort[/U] Initializes a new instance of the SerialPort class.[/COLOR][/FONT]
[FONT=Arial][COLOR=#008000][B]Public Events[/B]
[U]Disposed[/U] (inherited from Component)Adds an event handler to listen to the Disposed event on the component.
[U]ErrorEvent[/U] Represents the method that handles the error event of a SerialPort object.
[U]PinChangedEvent[/U] Represents the method that will handle the serial pin changed event of a SerialPort object.
[U]ReceivedEvent[/U] Represents the method that will handle the serial received event of a SerialPort object.[/COLOR][/FONT]
[FONT=Arial][COLOR=#008000][B]Public Fields[/B]
[U]InfiniteTimeout[/U] Value indicates that no timeout should occur.[/COLOR][/FONT]
[FONT=Arial][COLOR=#008000][B]Public Methods[/B]
[U]Close[/U] Closes the port connection, sets System.IO.Ports.IsOpen to false and disposes of the internal Stream object.
[U]CreateObjRef[/U] (inherited from MarshalByRefObject)Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
[SIZE=5][COLOR=Red][B][U]DiscardInBuffer[/U][/B][/COLOR][/SIZE] Discards data from the serial driver's receive buffer.
[U]DiscardOutBuffer[/U] Discards data from the serial driver's transmit buffer.
[U]Dispose[/U] (inherited from Component)Releases the resources used by the Component.
[U]Equals[/U] (inherited from Object)Determines whether the specified Object is equal to the current Object.
[U]GetHashCode[/U] (inherited from Object)Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
[U]GetLifetimeService[/U] (inherited from MarshalByRefObject)Retrieves the current lifetime service object that controls the lifetime policy for this instance.
[U]GetType[/U] (inherited from Object)Gets the Type of the current instance.
[U]InitializeLifetimeService[/U] (inherited from MarshalByRefObject)Obtains a lifetime service object to control the lifetime policy for this instance.
[U]Open[/U] Opens a new serial port connection.
[U]Read[/U] Reads from the SerialPort input buffer.
[U]ReadByte[/U] Synchronously reads one byte from the SerialPort input buffer.
[U]ReadChar[/U] Synchronously reads one character from the SerialPort input buffer.
[U]ReadExisting[/U] Reads all immediately available characters (based on the Encoding) in the stream and internal buffer of the SerialPort object.
[U]ReadLine[/U] Reads up to the NewLine value in the input buffer.
[U]ReadTo[/U] Reads up to the specified value in the input buffer.
[U]ToString[/U] (inherited from Component)Returns a String containing the name of the Component , if any. This method should not be overridden. For internal use only.
[U]Write[/U] Writes data to serial port output.
[U]WriteLine[/U] Writes the specified string and the NewLine value to the output buffer.[/COLOR][/FONT]
Dim incoming(sp.ReadBufferSize) As Byte
sp.Read(incoming, 0, sp.ReadBufferSize)
Dim input As String = ""
input = input & "Type: " & incoming(0)
input = input & " Length: " & incoming(1)
input = input & " Data: "
Dim i As Integer = 2
Do Until i = incoming.Length - 2
If incoming(i) <> 0 Then
input = input & Convert.ToChar(incoming(i))
End If
i = i + 1
Loop
Type: 65 Length: 16 Data: CFA633:h1.5,k1.9XÐ
Type: 65 Length: 16 Data: CFA
Type: 54 Length: 51 Data: 3:h1.5,k1.9XÐ
Dim Type as Byte
Dim Length as Byte
Dim Packet as String
Type = sp.ReadByte() 'get packet type
Length = sp.ReadByte() 'get data length
Packet = "Type: " & Type & " Length: " & Length & " "
If Length<>0 Then 'if any data in the packet
Dim i as Integer
Packet = Packet & " Data: "
For i = 0 To Length - 1 'read the data bytes
Packet = Packet & Convert.ToChar(sp.ReadByte())
Next i
Packet = Packet & " "
End If
Packet = Packet & "Crc: " & sp.ReadByte() 'the first crc byte
Packet = Packet & " " & sp.ReadByte() '2nd crc byte
'now this packet is done, the next character (if any) in the ReadBuffer is
'part of a new packet
If you look at the CFA633 data sheet, you will see that the answer is yes.Now I was just wondering if the incoming code that comes back is the same format as the outgoing. That being that the first byte is the type of command, the second byte the length, the rest being the data, the last 2 being the crc. From the code above, the input doesn't always seem consistent.
You are not counting the data bytes. The "XÐ" at the end of each string is the crc, expressed as ascii characters.For example, I ask the cfa633 for the serial number name etc, using command 1. It sends back this, using the above method:
Type: 65 Length: 16 Data: CFA633:h1.5,k1.9XÐ
but then running the same command again I receive
Type: 65 Length: 16 Data: CFA
Type: 54 Length: 51 Data: 3:h1.5,k1.9XÐ
in two lines rather than one, plus the data type and length are different. This isn't a big deal but just was trying to see if there is a more consistent way of receiving data, or if i am doing something wrong.
The CFA-633 packets are defined in the data sheet.. . . Now I was just wondering if the incoming code that comes back is the same format as the outgoing. . .