*SET DEFAULT TO curdir() *set step on *** downloaderHex.TXT must exist *** IF FILE('downloaderHex.txt') dHex = FOPEN('downloaderHex.txt') && Open the file ELSE WAIT WINDOW "DownloaderHex does not exist" ENDIF IF dHex < 0 &&If less than 0, then there was an error opening the file WAIT WINDOW "Error Opening DownloaderHex.txt" ENDIF firstLine = FGETS(dHex) &&get the first line of text from the txt file *Create an object ComForm.Testcom to reference the serial port PUBLIC ComForm ComForm = CREATEOBJECT('Form') ComForm.AddObject("Testcom","Olecontrol","MSCOMMLib.MSComm") ComForm.Testcom.CommPort = 2 && Use Comm2, The second Serial Port. ComForm.Testcom.Settings = "9600,N,8,1" && 9.6 Kbaud, No Parity, && 8 data Bits, 1 Stop Bit ComForm.Testcom.PortOpen = .T. &&opens the Serial Port ComForm.Testcom.RThreshold = 1 &&Sets the Serial ports buffer to recieve &&when 1 character is stored DO WHILE !FEOF(dHex) IF ComForm.Testcom.CommEvent = 2 &&This is triggered if the RThreshold is reached, which is 1 character IF ComForm.Testcom.Input = vbCrLf &&If a Carriage return is recieved ComForm.Testcom.Output = ">[1]" + firstLine + vbCrLf &&sends a line from the Hexfile WAIT WINDOW firstLine NOWAIT ENDIF ENDIF ENDDO fclose(dHex) WAIT WINDOW "DONE SENDING ALL LINES FROM DOWNLOADERHEX.TXT"