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 fclose(dHex) fopen("downloaderHex.txt") WAIT WINDOW "Error Opening DownloaderHex.txt" ENDIF 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 ComForm.Testcom.InputLen = 1 &&Amount of characters it reads from the buffer DO WHILE !FEOF(dHex) AutoYield = .F. IF ComForm.Testcom.CommEvent = 2 &&This is triggered if the RThreshold is reached oneChar = CHR(VAL(ComForm.Testcom.Input)) charLine = charLine + oneChar IF vbCrLf $ charLine &&If a Carriage return is recieved firstLine = FGETS(dHex) &&Get a line of code from the txt file 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"