05/24/11: GIME Serial Interrupt by sc, | Category: General, Programming | 3 comments - (Comments are closed)

GIME Serial Interrupt

Well, I’ve gotten serial input and output working doing it the old polling way, based on the unravelled code… now I am trying to build a serial input routine that automatically places bytes into an input buffer whenever data comes in, using the fancy serial interrupt. I want to be able to access the buffer whenever I feel like it, without having to put the code into a dedicated loop waiting for serial bits to come in…

So as far as I can tell my serial interrupt doesn’t fire. Does anyone know how the serial interrupt is supposed to trigger? I assumed a new irq would be generated for each state change on the rs232 port, meaning for each bit, regardless of whether it is a start/data/stop bit. I understand doing it this way rules out any massively fast baud rates, but I think at double cpu speed it should be possible to capture 38400 on down…

This post was submitted by sc.

3 comments to GIME Serial Interrupt

  • DarrenA

    The GIME serial interrupt is pretty useless. The engineers goofed. It triggers on a low-to-high transition of the data input, but a start bit is seen as a high-to-low transition.

  • sc

    That does sound a little useless. Would the first true low-to-high transition correspond to the first “1” bit being received? Meaning if I were receiving the byte value 1, I would miss the start bit, ignore all seven zero bits of the data value, then receive an interrupt on the one and only “1” bit? Not sure how that interrupt could be made useful.

    Better to set the fast timer interrupt to an interval that corresponds to a bit event, and break up the standard “polling” method to watch for either start, data, or stop bits as necessary during the timer event… not ideal either. huh.

  • DarrenA

    Bytes are transmitted lsb first, so a byte value of 1 would trigger the interrupt immediately following the start bit.

    If you want to use interrupts to detect and capture incoming serial data, your best bet would be to make a serial cable with the RxD and CD lines (pins 1 and 2 on the DIN connector) tied together. Then you can configure PIA2 to produce FIRQ on a high-to-low transition. This is the method I used to achieve 230400 bps on the CoCo 3 (it allows me to use a SYNC instruction for precise bit alignment).