Data transfer SHARP PC-1210/1211 to PC


In case you got one of those early handheld pocket computers and still kept the tapes (and they are still readable) you might want to document them on paper or www. But even if you also own the CE-122 printer, printing will not work because the black ribbon will be dry. Actually, there was a very good article in the german magazine "CHIP", August 1981 by Th. Müller, titled "Selbstbau Interface für Sharp PC-1211" (DIY interface for Sharp PC-1211).

Müller was using an AIM-65 microprocessor, but using an Arduino is much more fun. Anyway, without the information given in that article I had no chance to develop my interface. There is a 9-pin connector at the left hand side of the 1211. The first pin, located near the "Z" key, is the GND pin. The next three pins are for tape I/O only. Pin 5 is +Vcc. The next one is a control signal. Then you have a connect-input which you have to tie to the +Vcc with a 10 kOhms resistor. The next one is the busy input. You have to set it LOW to enable transmission. And the last one, located near the "OFF" key, is the data pin. I connected data to A5 and control to A4, hoping to be able to use the 2-wire protocol. But I was wrong. Data are transmitted using a strange serial protocol, having one start bit and four data bits transmitted at a rate of 500 bits per second. And I connected the busy pin to A3, but I could have connected it to GND as well. Finally I managed to receive the program listing of the PC-1211 in the serial terminal of the Arduino from where I can copy it to any file.

// Sharp PC-1210/1211 read printer port

#include <avr/pgmspace.h>
#include "basiCodes.h"

const byte busy    = A3;
const byte control = A4;
const byte data    = A5;
boolean newLine = true;

void setup() {
  Serial. begin(9600);
  Serial.println(__FILE__);
  pinMode(busy,OUTPUT);
  digitalWrite(busy,LOW);  // LOW = not busy
  while (digitalRead(control) == HIGH);
  // jetzt ist control LOW
}

void loop() {
  byte highNibble = getNibble();
  byte lowNibble  = getNibble();
  byte b = 16*highNibble+lowNibble;
  print(b);
  if (digitalRead(control) == HIGH) {
    Serial.println("ENDE");
    while (1);
  }
}

byte getNibble() {
  while (digitalRead(data) == 0); // warte auf Startbit
  get1bit(); // überlies Startbit
  byte b = 0;
  for (int i = 0; i < 4; i++) {
    b = (b >> 1) + get1bit();
  }
  return b;
}

byte get1bit() {
  byte b = !digitalRead(data);
  delay(2);
  return b << 3;
}

void print(byte code) {
  if (code == 141) return; // LIST
  if (code == 0) {
    Serial.println();
    newLine = true;
    return;
  }
  byte k = code;
  char c;
  int j = 0;
  while (k > 0) {
    c = pgm_read_byte_near(codes + j++);
    if (c == '|') k--;
  }
  if (newLine && (code >= 80)) {
    Serial.print(" ");
    newLine = false;
  }
  boolean ende = false;
  while (!ende) {
    c = pgm_read_byte(codes + j++);
    if (c == '|') ende = true;
    else Serial.print(c);
  }
}
Program to transfer program listings from the SHARP PC-1211 to the Serial Terminal of the Arduino

And this is the include file "basiCodes.h" to decode the BASIC codes:

const char codes[] PROGMEM = "ENTER||||||||||||||||INS| |\"|?|!|#|%|YEN|$|PI|SQR|,|;|:|||||||||||||||||||(|)|>|<|=|+|-|*|/|^|||||||0|1|2|3|4|5|6|7|8|9|.|EE|||||CURSOR|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z||||||||||||||||||||||||>=|<=|<>|||||||||(LIST)|(PRINT)||TO |STEP |THEN ||||||||||||||SIN|COS|TAN|ASN|ACS|ATN|EXP|LN|LOG|INT|ABS|SGN|DEG|DMS|||RUN|NEW|MEM|LIST|CONT|DEBUG|CSAVE|CLOAD|||||||||GRAD |PRINT |INPUT |RADIAN |DEGREE |CLEAR|||||||||||IF |FOR |LET |REM |END|NEXT |STOP|GOTO |GOSUB |CHAIN |PAUSE |BEEP |AREAD |USING |RETURN ||||||||||||||||||||||||||||||||||";

The codes for decoding then BASIC keywords etc. from the SHARP PC-1211
Sorry, this is a very long string. Make sure you copy it completely.

As you probably know, you have to press then "ON" key twice to force the SHARP to check for I/O connections. Otherwise the LIST command will go to the internal display as it normally does.




For your amusement only, here you find a decimal-to-hex-converter for the SHARP PC-1211.
I never again found a BASIC interpreter that accepts GOSUB xxx+yyy commands as in lines 40 to 70.

10 INPUT "DEZ: ";I
20 H=INT(I/256)
30 L=I-H*256
40 A=INT(H/16):GOSUB 100+A:B$=R$
50 A=H-A*16:GOSUB 100+A:C$=R$
60 A=INT(L/16):GOSUB 100+A:D$=R$
70 A=L-A*16:GOSUB 100+A:E$=R$
80 PRINT I;" $";B$;C$;D$;E$;" ";H;" ";L
99 END
100 R$="0":RETURN 
101 R$="1":RETURN 
102 R$="2":RETURN 
103 R$="3":RETURN 
104 R$="4":RETURN 
105 R$="5":RETURN 
106 R$="6":RETURN 
107 R$="7":RETURN 
108 R$="8":RETURN 
109 R$="9":RETURN 
110 R$="A":RETURN 
111 R$="B":RETURN 
112 R$="C":RETURN 
113 R$="D":RETURN 
114 R$="E":RETURN 
115 R$="F":RETURN 



contact: nji(at)gmx.de