04/05/08: Serial port programming to exchange data with a PC by ForthForEver, | Category: Programming | 13 comments - (Comments are closed)

Serial port programming to exchange data with a PC

I removed the dust of my coco3 and would like to exchange some data between the coco and a PC.
I wrote an assembly language routine to read and write the serial port… but I’m having a hard time finding it… I guess I will have to write it again!
So, maybe some of you have some pointers to old rainbow articles on the subject? I’am pretty sure there is some code hanging here and there that could be helpful (instead of writing that stuff from scratch again).
Maybe there are some code on the net? Any suggestion will be welcome.

13 comments to Serial port programming to exchange data with a PC

  • DarrenA

    You are welcome to the code I posted here:

    [url]http://coco3.com/users/DarrenA/SERBB56K.ASM[/url]

  • ForthForEver

    Great! Thank you so much.
    Just read the code and it is very very well written.
    I should try it on my coco3 this week.
    One of my old PC will soon be next to my coco but I have to replace the power supply first.
    I think I have a winME installed.
    Another option is to use my laptop but it only got USB ports.
    I quick google shows there are USB < --> RS232 converter out there: Is there someone using that kind of device? Is it reliable?

  • JP

    Another option is to use my laptop but it only got USB ports.
    I quick google shows there are USB < --> RS232 converter out there: Is there someone using that kind of device? Is it reliable?

    Most USB serial adapters use a Prolific chipset. Unfortunately, this is not the best kind to get. I’ve heard stories of this chipset dropping data and thus being somewhat unreliable.

    Look for an adapter that uses an FTDI chipset. This is the advice I was given by Cloud-9, who market a PC to CoCo file server that operates via the serial port.

    – JP

  • ForthForEver

    Thank you for the tip, JP.
    I will install my old PC (Pentium II 233Mhz / WinME) with a goog old RS232 and I will also get a FTDI-based converter.

  • JP

    Thank you for the tip, JP. I will install my old PC (Pentium II 233Mhz / WinME) with a goog old RS232 and I will also get a FTDI-based converter.

    I see you are in Canada, too. I looked high and low for an FTDI converter here in Canada, but to no avail. (Everything here seems to use a Prolific chipset–probably because its the cheapest to produce/buy. I have no idea what’s in the Keyspan adapters.) I ended up eBaying an FTDI adapter, getting one in from Hong Kong!

    – JP

  • DarrenA

    … I have no idea what’s in the Keyspan adapters.) I ended up eBaying an FTDI adapter, getting one in from Hong Kong!
    – JP

    All of the testing I did for the code posted above was done between a CoCo 3 and a Mac using a Keyspan High Speed USB serial adapter. I don’t know what chipset is in it, but it has worked flawlessly for me.

    I wrote a test program to continuously transmit a large block of data back and forth at 115.2K baud and verify that it remained intact. I ran it once for over an hour, and it has never lost a single bit.

  • ForthForEver

    You tell that you got the maximum speed with a USB-Serial adapter: What max speed should I expect from a classic COM1 port?

  • DarrenA

    You tell that you got the maximum speed with a USB-Serial adapter: What max speed should I expect from a classic COM1 port?

    Most standard PC serial ports will support 115.2K. All but the very ancient should support 56K.

  • ForthForEver

    I finally bought a belkin USB – DB9 converter, no idea what’s running inside.
    The model I bought is F5U409. I first tried at 2400 BPS and it’s running fine.
    Then, I tried at 4800 and 9600 and it does not work… This adapter is supposed to be ok up to 115Kbps…
    Do anybody use this adapter?
    I updated the driver, read the documentation, tried with another terminal program (REALterm), same result.
    I opened a ticket at Belkin… Hoping they can help…

    In the mean time, I would like to know if anybody has a bit banger assembly language driver for speed 2400 BPS…

    My plan was to use the 57K/115K version for which there is a link in this thread… I also found a 4800 and 9600 BPS asm source file…

    But for now, I would be happy with a 2400 BPS version!

  • Lagrangian

    I have no idea how good or bad their stuff is, but usbgear.com sells USB-RS232 adapters that use the FDTI chip.

  • ForthForEver

    I made some more tests using an inverter to connect two PCs together… The good news is that my USB-Serial converter get to work at any speed, 2400, 4800, 9600, up to 115200. But at any speed > 2400 there are some random junk characters here and there between the valid ones. For some reason, after a while the system stabilizes and only valid characters appear (hyperterm on both sides).
    On my coco, I use ultimate terminal; maybe it can only handle up to 2400 on the bit banger and higher speeds on the rs232 pack only.
    Anyway, I will continue experimenting with the 56k asm receive/send routine.

  • ForthForEver

    Looks like I was tired yesterday! I assembled my code which uses the 56K recv/send and it works great! For the moment I use it at .89 Mhz, when the application will work fine I’ll try to push it at 115K

  • DarrenA

    Glad to hear it! Now I have confimation that it works with other setups besides my own.