Page 1 of 1
Checking serial link
Posted: Fri Apr 19, 2013 11:31 am
by JonB
Hello
What's the quickest way to check a serial link on the QL using SuperBasic? I want to send some text to a Mac via a USB to serial adapter to ensure the cable is wired properly.
I guess the way is to OPEN a channel to SER2 then PRINT #n (where n is the channel number), but the manual doesn't seem to explain the OPEN syntax very well. Is it OPEN n, SER1? And how do I pick the channel number? Can I list all currently open channels?
Ultimately I want to transfer software to the QL via serial, but I have not seen may discussions or articles on how to do it. Can anyone advise?
Thanks
JonB
Re: Checking serial link
Posted: Fri Apr 19, 2013 12:08 pm
by tofro
JonB wrote:I guess the way is to OPEN a channel to SER2 then PRINT #n (where n is the channel number), but the manual doesn't seem to explain the OPEN syntax very well. Is it OPEN n, SER1? And how do I pick the channel number? Can I list all currently open channels?
Jon,
10 OPEN #3,ser2h
15 BAUD 1200
20 REPeat loop
30 PRINT #3,"TEST"
40 END REPEAT
should print to ser2 using hardware handshake (If you want to check your cable, then this is what you should do - In most cases where I have seen problems with the cables, people didn't get the handshake lines right). If this doesn't work, try "ser2_" (without the "h") if this works, you know you've got HW handshake wrong
Without a toolkit, it isn't possible to list currently open channels - After boot, #0, #1 and #2 are used for the screen channels, everything else should be unused. You need to keep track of the used channel numbers yourselves. There is a toolkit command "CHANNELS" that lists open channels - But where that came from currently escapes me.
Make sure when the QL is on the receiving end you don't use baud rates exceeding 9600 - The standard QL will not reliably receive using larger baud rates.
Regards,
Tobias
Re: Checking serial link
Posted: Fri Apr 19, 2013 4:14 pm
by JonB
With ser2h, nothing happens.
With ser2_ or "ser2_", I get a "bad name" error.
What about ser1, might that do it? Or is that just for modems?
Update: Ser 1 is giving rows of "~" (tilde) characters with no running program. However, when I run the program with OPEN #3, ser1 (or ser1h) it seems to send characters (just not the right ones).
Update 2: Full program:
5 CLS
10 OPEN #3, ser2h
15 BAUD 1200
20 PRINT#3, "test"
25 PRINT ".";
30 GOTO 20
The odd thing is, it prints 12 dots then stops. I am guessing that the send buffer is full. At the other end I am running a terminal program with the following settings : 1200 baud, no parity, 8 bits, 1 stop bit, no flow control, no hardware handshake (and also with HH, but it makes no difference).
Re: Checking serial link
Posted: Fri Apr 19, 2013 4:59 pm
by dex
The parameters are:
SER<portnumber><parity><handshake><conversion>
being 1, 2 for port (3 and more with SuperHermes)
e - even parity, o - odd parity, m - mark parity, s - space
h - handshaking, i - ignore handshaking
r - raw data, z - appends CTRL+Z to end of file, c - converts LF to CR and adds CTRL+Z to end of file.
I am making my serial cable for Samsung QL (not succesful yet), I have following simple terminal (don't know if it is correct, as tests with my cable were unsuccessful):
You can change SER1hr to SER1ir, to ignore handshaking (for the case that data wires are correct, but handshaking wiring is wrong).
10 OPEN #7,ser1hr
160 BAUD 19200 :REMark I have Hermes
170 a$=INKEY$(#7):print a$;
180 a$=INKEY$:print a$:print #7,a$;
200 GOTO 170
Re: Checking serial link
Posted: Fri Apr 19, 2013 5:52 pm
by JonB
Ah, that's better. Handshaking is killing it. Where are these channel numbers documented?
Re: Checking serial link
Posted: Fri Apr 19, 2013 6:01 pm
by tofro
The channel numbers don't mean anything, they are just arbitrary numbers you can pick.
Tobias
Re: Checking serial link
Posted: Fri Apr 19, 2013 6:09 pm
by JonB
Sorry, not the numbers, the names. I feel I have missed something in the QL manual... or is it not in there?
Re: Checking serial link
Posted: Fri Apr 19, 2013 7:12 pm
by tofro
I'm sure it's there.
In the Concepts section, I seem to recall.
Tobias
Re: Checking serial link
Posted: Fri Apr 19, 2013 10:02 pm
by JonB
I'll have another look. Got to say, I don't get on with the Sinclair guides, they are too tutorial-esque for me. I would have expected all that to be documented in the open statement section, or at least a reference to the relevant bit in Concepts.
Anyway, thanks to everyone and dex in particular I have sent text to the Mac. Next step is to get it back!
Re: Checking serial link
Posted: Sat Apr 20, 2013 10:49 am
by RWAP
As I think it is really important to be able to understand the complex subject of devices on the QL, I have uploaded a zip containing the Device Drivers Appendix from the SBASIC/SuperBASIC Reference Manual.
This is available from :
http://www.rwapsoftware.co.uk/downloads ... rivers.zip
Hopefully this will help explain some of the issues.
