Page 1 of 1

outputting text via GWBASIC

Posted: Sat May 17, 2003 8:48 pm
by erdc
Does anyone know if you can code GWBASIC to send out a text string to a LCD? And if so, how?

Posted: Tue May 27, 2003 3:57 pm
by Henry
As long as you can send data to a serial port, it's easy. Just send the bytes required to do what ever you want.

Posted: Fri May 30, 2003 12:22 am
by erdc
I am glad to hear that it is easy! So can you then show me the exact code that would send the text string "HELLO WORLD" from a GWBASIC executable file, that would in turn be displayed on a LCD?

Posted: Fri May 30, 2003 12:25 am
by Henry
This is not going to be exact code because I dont have GWBasic here, the the theory is easy. Figure out how to talk to a serial port from GWBASIC and then send the string to the serial port, there is nothing else to it.

EDIT

I did some searching on the net just now and came across this, maybe it will help

Code: Select all

1 REM This program by Aaron Cake (aaron.cake@blackhole.xg.com)
2 REM You are free to use it, give it away or modify it, as long
3 REM as this message remains intact.
4 REM http://www.execulink.com/~cake/  http://www.lmcs.edu.on.ca/jp2/students/aaronc/index.html

8 KEY OFF
9 ON ERROR GOTO 540
10 CLS
20 LOCATE 1,1
30 PRINT CHR$(201);
40 FOR I = 1 TO 78
50 PRINT CHR$(205);
60 NEXT I
70 PRINT CHR$(187);
80 PRINT CHR$(186);
90 FOR I=1 TO 78
100 PRINT " ";
110 NEXT I
120 PRINT CHR$(186);
130 PRINT CHR$(200);
140 FOR I=1 TO 78
150 PRINT CHR$(205);
160 NEXT I
170 PRINT CHR$(188);
180 LOCATE 2,2:PRINT "<D>ial, <H>ang up, <S>etup, <E>xit. Press ESC to close menu."
190 MENUCHOICE$=INKEY$
200 IF MENUCHOICE$="d" THEN GOTO 370
210 IF MENUCHOICE$="h" THEN CLOSE #1:CLOSE #2
220 IF MENUCHOICE$="s" THEN GOTO 251
230 IF MENUCHOICE$="e" THEN CLS:END
240 IF MENUCHOICE$=CHR$(27) THEN GOTO 490
250 GOTO 190
251 LOCATE 2,2
260 FOR I=1 TO 78
270 PRINT " ";
280 NEXT I
290 LOCATE 2,2:PRINT "COM port (1 or 2):     Speed:";
300 LOCATE 2,21:LINE INPUT PORTNUM$
310 LOCATE 2,32:LINE INPUT SPEED$
320 COMANDSPEED$= "COM" +  PORTNUM$ + ":"+SPEED$
330 OPEN "terminal.cfg" FOR OUTPUT AS #1
340 PRINT #1, COMANDSPEED$
350 CLOSE #1
360 GOTO 180
370 LOCATE 2,2
380 FOR I=1 TO 78
390 PRINT " ";
400 NEXT I
410 LOCATE 2,2
420 INPUT "Enter number to dial: ", NUMBER$
430 OPEN "terminal.cfg" FOR INPUT AS #1
440 LINE INPUT #1, COMPORT$
450 CLOSE #1
460 OPEN COMPORT$ + ",N,8,1" FOR RANDOM AS #1
470 OPEN "con" FOR OUTPUT AS #2
471 LOCATE 4,1
480 PRINT #1, "ATDT" + NUMBER$
483 FOR Q=1 TO 2
486 NEXT Q
490 USERINPUT$=INKEY$
500 IF USERINPUT$ <> "" THEN PRINT #1, USERINPUT$;
501 IF USERINPUT$=CHR$(27) THEN GOTO 20
510 IF NOT EOF(1) THEN MODEMIN$=INPUT$(LOC(1),#1):PRINT #2, MODEMIN$;
520 GOTO 490
530 END
540 IF ERR=24 THEN LOCATE 2,2:PRINT "Modem not connected.                      ";:INPUT " ",TEMP$:GOTO 10
550 IF ERR=52 THEN LOCATE 2,2:PRINT "Cannot open COM port.                     ";:INPUT " ",TEMP$:GOTO 10
560 IF ERR=57 THEN CLOSE #1:OPEN COMPORT$ + ",N,8,1" FOR RANDOM AS #1: GOTO 480
570 END