On Apr 26, 2007, at 2:01 AM, Gregory Omond wrote: > Sorry that I am such a "basic newbie"... I have dabbled a bit in C and > assembler and Delphi on PC, But now I am in Mac land (sick of viruses). > > Taken from the TI documentation (Series 2000 Reader system). > > All messages constructed according to the following format: > > Byte Contents > 0 Start-Mark (SOH,01hex) > 1 Destination Address > 2 Source Address > 3 Message-Code > 4 Data-Length > 5 Data-Field(1) > N+4 Data-Field(N) > N+5 CRC-Field(1) (MS Byte) > N+6 CRC-Field(2) > N+7 End-Mark(EOT, 04hex) > > I am just wanting to bang out a couple of packets to get the responses > and > verify my ideas. > So that I can get down to the serious part. > Just that the example serial programs supplied with RB show quoted > strings > going out i.e. Serial1.Write "Hello Blagh" whereas I need to do the > equivalent to Serial1.Write(0x01) (Sorry for the C syntax). > > I tried the following: > > Sub Action > > Serial1.SerialPort.OutputDriverName.Encoding.variant 0x00 > Serial1.Write 0x01 > Serial1.WriteInt8 0x01 > > > All cause an error. > > Thanks in advance
Gregory - To output and make your packet, just append characters into a string. Do not worry about encodings. I would do it thus (just to make it more obvious): Dim TheChar(N+7) as string Dim MySendString as string TheChar(0) = char(1) //SOH TheChar(1) = char(DestAddr) TheChar(2) = char(SourceAddr) TheChar(3) = char(MessageCode) . . . TheChar(N+7) = char(4) //EOT MySendString = "" //its initialized this way but I like to be obvious about it For J = 0 to N+7 MySendString = MySendString + TheChar(J) Next //J Serial1.Write MySendString Jim _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
