Topics

Elf called MAR1E sends her first ASCII characters #Serial #Homebrew

John
 

Hi All,

I've added a TC232 to Mar1e (top centre) so she can now send characters over RS-232. The pairs of LEDs to the right are in reverse parallel between ground and the TXD and RXD lines and they light up green and blue. The empty 20-pin socket is for a future 373.

The photo shows her sending M (for Mar1e of course) to the Psion Organiser II XP at 150bps. I wrote a simple program which set Q low or Q high then halted, and found from that that Q high was received as a start bit. Then I wrote a program which set Q high, ran a delay loop, set Q low, ran a delay loop again and repeated. I measured the pulse length on the 'scope and found that if I reduced the starting value of the loop from FF to D4 it produced pulses around 6.6ms, OK for 150BPS. Next I wrote a program which generated the start bit, eight data bits and an extended stop bit and sent these to the XP. Playing with 7Bs and 7As in the data bit loops I started getting recognisable characters on the screen. I also learned that the codes needed to be sent LSB first. 

I know this is a clumsy way to do it but it proves the circuit. Now I need to learn how to calculate the times taken for the instructions in the loop, make subroutines for the different characters, and try to figure out how to get characters from the XP into the Elf. That's another matter entirely. 

Just wanted to share this minor triumph with you!

 

John

ajparent1/kb1gmx
 

Bit bashing  serial using EF lines and Q are the norm for ELF based systems.  Works well
and costs near nothing.

IF you look at UT4 and the various monitors ther ewill be the needed serial in
and serial out routines.  Some do auto-baud.  Expect speeds under 4800 baud
depending on CPU clock maybe lower. 

Allison

Lee Hart
 

Congratulations! Step by step...

Here's a simple way to test your serial I/O hardware. Write a program that reads EF3 (or whatever flag bit you are using for serial input, and echoes it to Q (or whatever you are using for serial output). Something like:

addr data
---- ----
0000 3603 If EF3 pin is high,
0002 7B Set Q
0003 3E05 If EF3 pin is low,
0005 7A Reset Q
0006 3000 Branch to start

1802 clock speed and baud rate don't matter. Any key you type on your terminal keyboard should be echoed back to your display. This verifies that things are hooked up correctly.

If it doesn't work, try swapping the Set Q and Reset Q instructions.


--
Excellence does not require perfection. -- Henry James
--
Lee A. Hart http://www.sunrise-ev.com

Lee Hart
 

Oops; address 0003 should be 3E00 (not 3E05)

Corrected version:

addr data comments
---- ---- --------
0000 3603 BR3 0 If EF3 pin is high,
0002 7B SEQ Set Q
0003 3E06 BN3 6 If EF3 pin is low,
0005 7A REQ Reset Q
0006 3000 BR 0 Branch to start


--
Excellence does not require perfection. -- Henry James
--
Lee A. Hart http://www.sunrise-ev.com

Ham Radio
 

Nice job!  Nice feeling to get something to work that you have built yourself.

There are ASCII bit banger routines in the IPSO Facto archives.  See issue  47 page 26 for an example.
--
Regards,
Bernie Murphy

Lee Hart
 

Ham Radio wrote:
Nice job! Nice feeling to get something to work that you have built
yourself.

There are ASCII bit banger routines in the IPSO Facto archives. See
issue 47 page 26 for an example.
And, we've had some new ones developed recently by members of this forum that run up to 9600 baud (and more). There is also a great little downloader program that's small enough to toggle in.

--
Fools ignore complexity. Pragmatists suffer it. The wise avoid it.
Geniuses remove it. -- Alan Perlis, "Epigrams on Programming"
--
Lee Hart, 814 8th Ave N, Sartell MN 56377, www.sunrise-ev.com

John
 

Thanks for all the help!

Allison wrote "Expect speeds under 4800 baud depending on CPU clock maybe lower."

Any speed will make me happy if it works! I'm using a 1MHz clock. 

Lee, I'm using EF1 and this code echoes a character, all the way up to 9600bps, the upper limit for the Psion. 

0000  34 03   B1 03  Short branch if EF1 = 1
0002  7A        REQ    Reset Q
0003  3C 06   BN1 06  Short branch if EF1 = 0
0005  7B        SEQ    Set Q
0006  30 00    BR 00  Short branch to 00

Now I know the input hardware is working I want to try capturing a character, modifying it (maybe incrementing it or adding 20 hex to turn A into a), and sending it back. Another small step.

I've made an Excel spreadsheet to help me with the opcodes. It's a 16 x 16 grid with just the mnemonic in each cell (except for 68 which I think isn't used). When I put the mouse pointer over a cell a comment box appears. For example the cell for 34 has the comment

Short Branch if EF1 = 1
(Go to MM if EF1 = 1)
If EF1 = 1, M(R(P)) → R(P).0
Else R(P) + 1 → R(P)
34 MM

The second line is a comment in my own words. The last line is a reminder of how many bytes the instruction will take. The comments aren't complete yet but I'm adding them as I become familiar with an instruction, and changing the background colour to pale green for those that I know to be right. I'll upload it when it's finished if anyone else would like to use it.

Bernie, I've got that Ipso Facto open now. Thanks for the pointer.

73,

John G4EDX


On Sat, 13 Apr 2019 at 22:55, ajparent1/kb1gmx <kb1gmx@...> wrote:
Bit bashing  serial using EF lines and Q are the norm for ELF based systems.  Works well
and costs near nothing.

IF you look at UT4 and the various monitors ther ewill be the needed serial in
and serial out routines.  Some do auto-baud.  Expect speeds under 4800 baud
depending on CPU clock maybe lower. 

Allison

thinkpast
 

Lee Hart wrote:

And, we've had some new ones developed recently by members of this forum
that run up to 9600 baud (and more). There is also a great little
downloader program that's small enough to toggle in.
http://www.retrotechnology.com/memship/mship_test.html

Test programs for the 1802 Membership Card, include the serial echo routine Lee Hart mentioned. There's also a link to a binary serial loader at

http://www.retrotechnology.com/memship/mship_binloader.html

There's any number of Web pages on my site, about serial interfaces and serial software. A Web search like "cosmac serial" with the phrase "site:retrotechnology.com", will find many such pages. Or check my home-page for COSMAC software:

http://www.retrotechnology.com/memship/mship_soft.html

Serial hardware is a little challenging; you can build old-school transistor interfaces, or use a TTL/RS-232 chip, or use a TTL/USB device. Multiple pages on my Web site cover these, but all under "hardware" at

http://www.retrotechnology.com/memship/mship_hard.html

If these appear "unorganized", 1) use google 2) it's 10 years of Web pages and 40 years of COSMAC 1802's.

Herb Johnson