www.cavefischer.at/Sharp Pocket Computer


Emulator SHARP Thermodrucker CE-126P mit Arduino UNO


Dieses Arduino Programm emuliert den Sharp Thermodrucker CE-126P auf einem Arduino UNO. Mit einem Sharp Pocket Computer können damit die Standard Druckbefehle für den externen Drucker (LLIST, LPRINT) verwendet werden, um die Ausgabe über den Arduino an eine serielle Schnittstelle weiterzuleiten und z.B. am Serial-Monitor der Arduino IDE auszugeben. Unterschiedliche Modelle von Sharp Pocket Computern kommunizieren auf unterschiedliche Art und Weise mit dem Drucker CE-126P, siehe einige Beispiele unterhalb. Damit die Datenübertragung stabil läuft, ist es notwendig pull-down Widerstände (z.B. 10kOhm) von den Daten- und Steuerungsleitungen gegen GND zu schalten.

Emulator passend für folgende Sharp Pocket Computer:



Emulator SHARP CE-126P mit Arduino UNO für Sharp PC-1250A


// Emulator Sharp CE-126P für PC-1250A

const int IN_SEL2 = 3; // Pin D3, SEL2 Sharp PC-1250A, pin 10 der 11-pol. Buchsenleiste
const int OUT_ACK = 4; // Pin D4, ACK  Sharp PC-1250A, pin  9 der 11-pol. Buchsenleiste
const int IN_Dout = 8; // Pin D8, Dout Sharp PC-1250A, pin  5 der 11-pol. Buchsenleiste
const int IN_Busy = 9; // Pin D9, Busy Sharp PC-1250A, pin  4 der 11-pol. Buchsenleiste
const int InfoLED = 13;
boolean Busy;
boolean SEL2;
int DataBit;
int DataByte;
long Timeout;
int i;

void setup() {
Serial.begin(9600);
pinMode(OUT_ACK, OUTPUT);
pinMode(IN_Dout, INPUT);
pinMode(IN_Busy, INPUT);
pinMode(IN_SEL2, INPUT);
pinMode(InfoLED, OUTPUT);
Serial.println();
Serial.println("Bereit:");
Serial.println();
}

void loop() {

digitalWrite(InfoLED, LOW);
SEL2 = digitalRead(IN_SEL2);
Busy = digitalRead(IN_Busy);

if (SEL2 && Busy) {
// Daten:
digitalWrite(InfoLED, HIGH);
i = 0;
DataByte = 0;
do {
Timeout = millis();
do {
Busy = digitalRead(IN_Busy);
if (millis() - Timeout > 50) break;
} while (!Busy);
delayMicroseconds(500);
DataBit = digitalRead(IN_Dout);
digitalWrite(OUT_ACK, HIGH);
do {
Busy = digitalRead(IN_Busy);
} while (Busy);
delayMicroseconds(480);
digitalWrite(OUT_ACK, LOW);
DataByte = DataByte | (DataBit << i);
i++;
} while (i < 8);
// Ausgabe:
switch (DataByte) {
case 13:
Serial.println();
break;
default:
if (DataByte > 31 && DataByte < 127) Serial.print(char(DataByte));
}
}

} // Ende loop


Pinbelegung
Arduino UNO Pin Name Sharp PC 11-pol.
Schnittstelle
GND GND Pin 3
D9 (Input) Busy Pin 4
D8 (Input) Dout Pin 5
D4 (Output) ACK Pin 9
D3 (Input) SEL2 Pin 10
                           ┌-----┐
┌----(PWR)-----------------┤ USB ├--┐
|                          └-----┘  |
|       GND/RST2  [ ][ ]            |
|     MOSI2/SCK2  [ ][ ]  A5/SCL[ ] |
|        5V/MISO2 [ ][ ]  A4/SDA[ ] |
|                           AREF[ ] |
|                            GND[.] |--GND
| [ ]NC              LED/SCK/D13[.] |
| [ ]IOREF              MISO/D12[ ] |
| [ ]RST                MOSI/D11[ ]~|
| [ ]3V3    ┌---┐            D10[ ]~|
| [ ]5V    -| A |-            D9[.]~|--D9 ← Busy
| [ ]GND   -| R |-            D8[.] |--D8 ← Dout
| [ ]GND   -| D |-                  |
| [ ]Vin   -| U |-            D7[ ] |
|          -| I |-            D6[ ]~|
| [ ]A0    -| N |-            D5[ ]~|
| [ ]A1    -| O |-            D4[.] |--D4 → ACK  
| [ ]A2     └-^-┘        INT1/D3[.]~|--D3 ← SEL2 
| [ ]A3                  INT0/D2[ ] |
| [ ]A4/SDA RST SCK MISO  TX→/D1[.] |
| [ ]A5/SCL [ ] [ ] [ ]   RX←/D0[ ] |
|           [ ] [ ] [ ]             |
| UNO R3    GND MOSI 5V   _________╱
 ╲______________________╱
           ┌-------------------------
           | SHARP POCKET COMPUTER
           |
           |  ┌-----------
           |  |
           |  |  LCD
           |  |
           |  └-----------
           |
           |
           [ ] 1
           [ ] 2 6V
      GND--[.] 3 GND
D9 ← Busy--[.] 4 Busy
D8 ← Dout--[.] 5 Dout
           [ ] 6 Xin
           [ ] 7 Xout
           [ ] 8 Din
D4 → ACK---[.] 9 ACK
D3 ← SEL2--[.]10 SEL2
           [ ]11 SEL1
           |
           |
           └-------------------------
 
 
zum Seitenanfang



Emulator SHARP CE-126P mit Arduino UNO für Sharp PC-1260, PC-1261, PC-1262


// Emulator Sharp CE-126P für PC-1260

const int IN_SEL1 = 2; // Pin D2, SEL1 Sharp PC-1260, pin 11 der 11-pol. Buchsenleiste
const int IN_SEL2 = 3; // Pin D3, SEL2 Sharp PC-1260, pin 10 der 11-pol. Buchsenleiste
const int OUT_ACK = 4; // Pin D4, ACK  Sharp PC-1260, pin  9 der 11-pol. Buchsenleiste
const int IN_Dout = 8; // Pin D8, Dout Sharp PC-1260, pin  5 der 11-pol. Buchsenleiste
const int IN_Busy = 9; // Pin D9, Busy Sharp PC-1260, pin  4 der 11-pol. Buchsenleiste
const int InfoLED = 13;
boolean Busy;
boolean SEL1;
boolean SEL2;
int DataBit;
int DataByte;
long Timeout;
int i;

void setup() {
Serial.begin(9600);
pinMode(OUT_ACK, OUTPUT);
pinMode(IN_Dout, INPUT);
pinMode(IN_Busy, INPUT);
pinMode(IN_SEL1, INPUT);
pinMode(IN_SEL2, INPUT);
pinMode(InfoLED, OUTPUT);
Serial.println();
Serial.println("Bereit:");
Serial.println();
}

void loop() {

digitalWrite(InfoLED, LOW);

SEL1 = digitalRead(IN_SEL1);
SEL2 = digitalRead(IN_SEL2);

if (SEL2 && SEL1) {
// DeviceSelect:
digitalWrite(InfoLED, HIGH);
delayMicroseconds(50);
i = 0;
do {
SEL1 = digitalRead(IN_SEL1);
} while (SEL1);
Timeout = millis();
do {
Busy = digitalRead(IN_Busy);
if (millis() - Timeout > 50) break;
} while (!Busy);
delayMicroseconds(50);
digitalWrite(OUT_ACK, HIGH);
Timeout = millis();
do {
SEL1 = digitalRead(IN_SEL1);
if (millis() - Timeout > 50) break;
} while (!SEL1);
delayMicroseconds(150);
digitalWrite(OUT_ACK, LOW);
do {
SEL1 = digitalRead(IN_SEL1);
} while (SEL1);
delayMicroseconds(150);
}

Busy = digitalRead(IN_Busy);

if (Busy) {
// Daten:
digitalWrite(InfoLED, HIGH);
i = 0;
DataByte = 0;
do {
do {
Busy = digitalRead(IN_Busy);
} while (!Busy);
delayMicroseconds(500);
DataBit = digitalRead(IN_Dout);
digitalWrite(OUT_ACK, HIGH);
do {
Busy = digitalRead(IN_Busy);
} while (Busy);
delayMicroseconds(480);
digitalWrite(OUT_ACK, LOW);
DataByte = DataByte | (DataBit << i);
i++;
} while (i < 8);
// Ausgabe:
switch (DataByte) {
case 13:
Serial.println();
break;
default:
if (DataByte > 31 && DataByte < 127) Serial.print(char(DataByte));
}
}

} // Ende loop


Pinbelegung
Arduino UNO Pin Name Sharp PC 11-pol.
Schnittstelle
GND GND Pin 3
D9 (Input) Busy Pin 4
D8 (Input) Dout Pin 5
D4 (Output) ACK Pin 9
D3 (Input) SEL2 Pin 10
D2 (Input) SEL1 Pin 11
                           ┌-----┐
┌----(PWR)-----------------┤ USB ├--┐
|                          └-----┘  |
|       GND/RST2  [ ][ ]            |
|     MOSI2/SCK2  [ ][ ]  A5/SCL[ ] |
|        5V/MISO2 [ ][ ]  A4/SDA[ ] |
|                           AREF[ ] |
|                            GND[.] |--GND
| [ ]NC              LED/SCK/D13[.] |
| [ ]IOREF              MISO/D12[ ] |
| [ ]RST                MOSI/D11[ ]~|
| [ ]3V3    ┌---┐            D10[ ]~|
| [ ]5V    -| A |-            D9[.]~|--D9 ← Busy
| [ ]GND   -| R |-            D8[.] |--D8 ← Dout
| [ ]GND   -| D |-                  |
| [ ]Vin   -| U |-            D7[ ] |
|          -| I |-            D6[ ]~|
| [ ]A0    -| N |-            D5[ ]~|
| [ ]A1    -| O |-            D4[.] |--D4 → ACK
| [ ]A2     └-^-┘        INT1/D3[.]~|--D3 ← SEL2
| [ ]A3                  INT0/D2[.] |--D2 ← SEL1
| [ ]A4/SDA RST SCK MISO  TX→/D1[.] |
| [ ]A5/SCL [ ] [ ] [ ]   RX←/D0[ ] |
|           [ ] [ ] [ ]             |
| UNO R3    GND MOSI 5V   _________╱
 ╲______________________╱
           ┌-------------------------
           | SHARP POCKET COMPUTER
           |
           |  ┌-----------
           |  |
           |  |  LCD
           |  |
           |  └-----------
           |
           |
           [ ] 1
           [ ] 2 6V
      GND--[.] 3 GND
D9 ← Busy--[.] 4 Busy
D8 ← Dout--[.] 5 Dout
           [ ] 6 Xin
           [ ] 7 Xout
           [ ] 8 Din
D4 → ACK---[.] 9 ACK
D3 ← SEL2--[.]10 SEL2
D2 ← SEL1--[.]11 SEL1
           |
           |
           └-------------------------
 
 

Signalverlauf beim PC-1260 bei LLIST für folgendes Programm:   5:PRINT "HALLO WELT"



zum Seitenanfang



Emulator SHARP CE-126P mit Arduino UNO für Sharp PC-1401, PC-1403, PC-E500


// Emulator Sharp CE-126P für PC-1401, PC-1403 u. PC-E500

const int OUT_ACK = 4; // Pin D4, ACK  Sharp PC-1401, pin 9 der 11-pol. Buchsenleiste
const int IN_Xout = 6; // Pin D6, Xout Sharp PC-1401, pin 7 der 11-pol. Buchsenleiste
const int IN_Dout = 8; // Pin D8, Dout Sharp PC-1401, pin 5 der 11-pol. Buchsenleiste
const int IN_Busy = 9; // Pin D9, Busy Sharp PC-1401, pin 4 der 11-pol. Buchsenleiste
const int InfoLED = 13;
boolean Busy;
boolean Xout;
int DataBit;
int DataByte;
int i;

void setup() {
Serial.begin(9600);
pinMode(OUT_ACK, OUTPUT);
pinMode(IN_Xout, INPUT);
pinMode(IN_Dout, INPUT);
pinMode(IN_Busy, INPUT);
pinMode(InfoLED, OUTPUT);
Serial.println();
Serial.println("Bereit:");
Serial.println();
}

void loop() {

digitalWrite(InfoLED, LOW);

Xout = digitalRead(IN_Xout);

if (Xout) {
// DeviceSelect:
digitalWrite(InfoLED, HIGH);
delayMicroseconds(50);
i = 0;
do {
digitalWrite(OUT_ACK, HIGH);
do {
Busy = digitalRead(IN_Busy);
} while (!Busy);
delayMicroseconds(50);
digitalWrite(OUT_ACK, LOW);
do {
Busy = digitalRead(IN_Busy);
} while (Busy);
delayMicroseconds(150);
i++;
} while (i < 8);
do {
Xout = digitalRead(IN_Xout);
} while (Xout);
digitalWrite(OUT_ACK, HIGH);
delayMicroseconds(500);
digitalWrite(OUT_ACK, LOW);
}

Busy = digitalRead(IN_Busy);

if (Busy && !Xout) {
// Daten:
digitalWrite(InfoLED, HIGH);
i = 0;
DataByte = 0;
do {
do {
Busy = digitalRead(IN_Busy);
} while (!Busy);
delayMicroseconds(50);
DataBit = digitalRead(IN_Dout);
digitalWrite(OUT_ACK, HIGH);
do {
Busy = digitalRead(IN_Busy);
} while (Busy);
delayMicroseconds(50);
digitalWrite(OUT_ACK, LOW);
DataByte = DataByte | (DataBit << i);
i++;
} while (i < 8);
// Ausgabe:
switch (DataByte) {
case 13:
Serial.println();
break;
case 48:
Serial.print("O"); // Buchstabe "O"
break;
case 240:
Serial.print("0"); // Ziffer Null
break;
default:
if (DataByte > 31 && DataByte < 127) Serial.print(char(DataByte));
}
}

} // Ende loop


Pinbelegung
Arduino UNO Pin Name Sharp PC 11-pol.
Schnittstelle
GND GND Pin 3
D9 (Input) Busy Pin 4
D8 (Input) Dout Pin 5
D6 (Input) Xout Pin 7
D4 (Output) ACK Pin 9
                           ┌-----┐
┌----(PWR)-----------------┤ USB ├--┐
|                          └-----┘  |
|       GND/RST2  [ ][ ]            |
|     MOSI2/SCK2  [ ][ ]  A5/SCL[ ] |
|        5V/MISO2 [ ][ ]  A4/SDA[ ] |
|                           AREF[ ] |
|                            GND[.] |--GND
| [ ]NC              LED/SCK/D13[.] |
| [ ]IOREF              MISO/D12[ ] |
| [ ]RST                MOSI/D11[ ]~|
| [ ]3V3    ┌---┐            D10[ ]~|
| [ ]5V    -| A |-            D9[.]~|--D9 ← Busy
| [ ]GND   -| R |-            D8[.] |--D8 ← Dout
| [ ]GND   -| D |-                  |
| [ ]Vin   -| U |-            D7[ ] |
|          -| I |-            D6[.]~|--D6 ← Xout
| [ ]A0    -| N |-            D5[ ]~|
| [ ]A1    -| O |-            D4[.] |--D4 → ACK
| [ ]A2     └-^-┘        INT1/D3[ ]~|
| [ ]A3                  INT0/D2[ ] |
| [ ]A4/SDA RST SCK MISO  TX→/D1[.] |
| [ ]A5/SCL [ ] [ ] [ ]   RX←/D0[ ] |
|           [ ] [ ] [ ]             |
| UNO R3    GND MOSI 5V   _________╱
 ╲______________________╱
           ┌-------------------------
           | SHARP POCKET COMPUTER
           |
           |  ┌-----------
           |  |
           |  |  LCD
           |  |
           |  └-----------
           |
           |
           [ ] 1
           [ ] 2 6V
      GND--[.] 3 GND
D9 ← Busy--[.] 4 Busy
D8 ← Dout--[.] 5 Dout
           [ ] 6 Xin
D6 ← Xout--[.] 7 Xout
           [ ] 8 Din
D4 → ACK---[.] 9 ACK
           [ ]10
           [ ]11
           |
           |
           └-------------------------
 
 

Signalverlauf beim PC-1401 bei LLIST für folgendes Programm:   5:PRINT "HALLO WELT"



zum Seitenanfang


© 2016-2022: Walter Fischer