Skip to content

Host I/O for the 1802 Olduino

January 24, 2017

This is just a reminder for me of how host I/O works on the 1802 Olduino.  The 1802 sends output to port 7 activating N lines 0,1,2.  N2 loads the output latch on the membership card.  N1 notifies the AVR that there’s output and clocks it into the 74165 shift register. N0 tells the AVR that the data is for the host. If it sees N1 without N0 it just clocks the SPI output. There’s currently no explicit provision for input from the host to an 1802 program.

I made a slight modification to the AVR program that allows for bidirectional comm.  In principle it’s simple; as noted above, the AVR is in a tight loop waiting for the 1802 to do output to port 6 or 7.  If it’s 7 it sends the character to the host and, if there’s serial data available the AVR clocks it into the MISR shift register where the 1802 can read it on port 7 (or 6 i suppose).  There are two problems with this: first, to allow Serial.available to work I can’t disable interrupts which risks losing 1802 data and second, there is no flow control or signal from the AVR to the 1802 to know that there’s data available and there’s no way for the AVR to know the data has been read.

**Edit: it occurs to me that the AVR has control of the 1802’s /EF4 flag pin so i could easily use that to tell the 1802 there’s data available.**

  //noInterrupts(); //disallow interrupts while the 1802 is running
  while(true){ //loop for 1802 program output
    while (PIND&0x40); //wait for SPI signal to go low
    pindsave=PIND; //grab the n0 line while it's valid
    while (0==(PIND&0x40)); //wait for trailing edge - signal goes high again
    if (pindsave&0x04){ //if it's for me  ** have to test this now
      char1802=busin(); //grab the character and clock the SPI bus
      cout<<_BYTE(char1802); //send it to the host

      if (Serial.available()){
        uint8_t ch =getch();
        busout(ch);
      } else{
        busout('?');
      }
    } else{ //not for me, have to do this fast
      justclock(); //just clock the SPI bus
    }
  }

This isn’t anything like hopeless though. Other SPI peripherals get by quite nicely without losing data. They signal data availability “in band” by having a status register that the 1802 can query over the same SPI channel where the data can flow. I’m sure an SPI UART would do the same. In fact, looking at the MAX3108 SPI UART I see that it has a couple of out-of-band communications pins. Maybe most importantly, it uses the SS pin to signal the UART for the beginning and end of transactions. I could do that dedicating a bit in the parallel out port like any other SPI peripheral.

ref olduinoII_ISPV5F.ino, olduino_2.0_v8e.sch(below),
membership card schematic
MAX3108 modem interface

17-02-10-schematic-v8e17-02-10-block-diagram

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: