Suppose that I have a VB application (or could be some other application on a PC) that I want to send a packet of information from the PC to the Pro at some random time. In my case I may have my over VB sequencer and when the user does something I want to tell my Brat about it. The problem that I run into is that there is no hardware support built into the Pros handling the serial IO for the main serial IO port (S_IN, S_OUT). So unless the Atom Pros code is sitting in a SERIN statement, the input is lost. The problem is that I don’t always want my my brat sitting around waiting for input from the PC. It has to also do things like receive commands from the TV remote, walk, etc.
So I have been trying out different approaches. None of them have been as reliable as I would like. I am in the process of trying out a different approach, that I am not sure will work or not. This is sort of hard to explain, but I will try:
It is my understanding that both S_IN and S_OUT are connected to P14 by a diode half duplex circuit. This is from the thread:
lynxmotion.net/viewtopic.php?t=2597&highlight=diode
On the H8/3694 P14 is the pin for IRQ0, which AcidTech mentioned in a different thread:lynxmotion.net/viewtopic.php?t=3417&highlight=irq0 My guess is this is not by accident.
So a thought came to mind. Could my Pro basic program set an interrupt handler for IRQ0. I would guess that I would have to setup a few H8 IO registers, like probably set bit4 in PMR1 to tell the H8 that that IO pin is for an interrupt and not general IO. Likewise I would probably need to set bit 0 of IEGR1 to say I want the interrupt on the leading edge.
My idea is to setup the IRQ0 interrupt on the PRO.
On the PC side have my prgram output one byte of 0xff. with the inversion I believe that I will get an upspike for the start bit and then all of the databits and stop bit will show as a low voltage.
Now if I can at that point get the Atom Pro code to process that as an interrupt. I would then switch the pin back to being standard IO and try to do a serin of the packet of information. On the PC side I would delay a short time after outputing the 0xff and then output the packet. Assuming all of this works, the Pro would send back some form of Ack to the PC.
I have hacked up my first attempt at this and so far my interrupt handler has not been called. A thought came to mind that maybe the inverted signals that I have been seing at the external SIN/SOUT pins of the pro are inverted from the signals that are actually on the H8 P14 pin. So I will try experimenting and maybe interrupt on the other edge. I don’t think this will help as the input on the line generates both edges, but what the heck…
Suggestion? I will probably directly email acidtech as well.
Kurt