Writing data to a COM port requires that the data be binary in form. The PRINT command by default converts numbers to base 10 for display, and not base 256. The CHR$() function converts a number between 0 and 255 into the corresponding digit in base 256, which can then be transferred to the COM port. As for representing the number itself, what Pappy1942 said is essentially correct; a number preceded by &H is treated as hexadecimal -- base 16 -- while a number preceded by &O is treated as octal, base 8. If you wanted to send a carriage return & linefeed pair (characters D and A in hexadecimal, respectively) to the COM port open as file #1, you would do the following:
[tt]PRINT #1, CHR$(&HD); CHR$(&HA);[/tt]
Note the semicolon at the end, which prevents QB from inserting its own newline information. QuickBASIC seldom understands the needs of serial connection protocols, so it is best to handle them yourself. Hope this helps =}