Hi all,
I'm converting an old app from QB45 to PBWin, and have been fairly successful so far, with one exception - trying to send a short text string to a serial port.
The string is sent to "wake up" a device connected to COM1.
The computer has been upgraded from DOS6.22 to XP/SP3, and the old DOS app no longer works, hence the rewrite.
I can use Hyperterminal (not running at the same time as PB!) etc, set to 9600 baud/8/N/1 on COM1, type in the string SINAR, hit Enter, and it works every time.
No luck in PB. The answer is probably fairly simple, but I couldn't see anything obvious in the help.
All it has to do is open the port, send the string, then close the port.
No other apps are running.
Code:
The messagebox displays "No Error".
Any help on this one gratefully appriciated.
I'm converting an old app from QB45 to PBWin, and have been fairly successful so far, with one exception - trying to send a short text string to a serial port.
The string is sent to "wake up" a device connected to COM1.
The computer has been upgraded from DOS6.22 to XP/SP3, and the old DOS app no longer works, hence the rewrite.
I can use Hyperterminal (not running at the same time as PB!) etc, set to 9600 baud/8/N/1 on COM1, type in the string SINAR, hit Enter, and it works every time.
No luck in PB. The answer is probably fairly simple, but I couldn't see anything obvious in the help.
All it has to do is open the port, send the string, then close the port.
No other apps are running.
Code:
Code:
SUB SerialSend LOCAL ComChannel AS INTEGER LOCAL ComPort AS STRING 'open the comm port and send the string "SINAR" to it ComChannel = FREEFILE ComPort = "COM1" COMM OPEN ComPort AS ComChannel COMM SET ComChannel, BAUD = 9600 '9600 baud COMM SET ComChannel, BYTE = 8 '8 bits COMM SET ComChannel, PARITY = 0 'No parity COMM SET ComChannel, STOP = 0 '1 stop bit COMM SET ComChannel, TXBUFFER = 4096 '4 Kb transmit buffer COMM SET ComChannel, RXBUFFER = 4096 '4 Kb receive buffer COMM PRINT ComChannel,"SINAR" 'Temporary line - show a message box to see if we have an error MSGBOX ERROR$(ERRCLEAR),,"Sending" ' '*** Message box displays "No Error" *** ' 'Finished - close the serial port COMM CLOSE ComChannel END SUB
Any help on this one gratefully appriciated.
Comment