01-06-2014, 06:44 PM
This is from a few years ago, but since Arduino is probably trending topic maybe it is interesting to keep records of this procedure.
1) Connections
You can use an audio-cd cable for the connections. Just follow:
HP-48 GND to Arduino GND, RX to TX and TX to RX arduino pins respectively.
2) HP-48 serial server code scripts
START:
REV:
RREV:
RREP:
P:
IOPAR (it's the default one):
3) Arduino sample code
Just send 0x00 and then any command you want to evaluate!
If you want responses from the arduino, you have to XMIT them to you back to the microprocessor, example:
And that's all!
___________________________
Working sample
Here is a bit more lengthy sample for the arduino:
http://servicios.ried.cl/arduino/hp48_la...ounter.pde
That counts boxes:
1) Connections
You can use an audio-cd cable for the connections. Just follow:
HP-48 GND to Arduino GND, RX to TX and TX to RX arduino pins respectively.
2) HP-48 serial server code scripts
START:
Code:
<< CLLCD 0 'N' STO CLOSEIO CLLCD "READY" 1 DISP OPENIO REV >>
REV:
Code:
<< CLLCD BUFLEN DROP SRECV DROP DUP "" == IF THEN DROP ELSE RREP OBJ-> END REV >>
RREV:
Code:
<< BUFLEN DROP SRECV DROP DUP "" == IF THEN DROP ELSE RREP 1 CLLCD DISP END REV >>
RREP:
Code:
<< "" -> S Q << S 1 S SIZE START DUP NUM 255 - NEG 2 / CHR Q SWAP + 'Q' STO TAIL NEXT DROP Q >> >>
P:
Code:
<< BUFLEN DROP SRECV DROP >>
IOPAR (it's the default one):
Code:
{ 9600 0 0 0 3 3 }
3) Arduino sample code
Just send 0x00 and then any command you want to evaluate!
Code:
void setup()
{
Serial.begin(9600);
// Preparing the calculator
Serial.print(0x00,BYTE);
Serial.print("#131 #64 BLANK PICT STO { #0 #0 } PVIEW ");
delay(100);
Serial.print(0x00,BYTE);
Serial.print("\"\\<<\" \"HELLO WORLD\" 34 CHR SWAP + 34 CHR + \"
MSGBOX \\>>\" + + OBJ\\-> 'helloworld' STO ");
delay(100);
Serial.print(0x00,BYTE);
Serial.print("PICT { #2 #2 } \"Starting...\" 1 \\->GROB REPL
1000 0.2 BEEP 2000 0.1 BEEP 1 WAIT");
}
If you want responses from the arduino, you have to XMIT them to you back to the microprocessor, example:
Code:
Serial.print(0x00,BYTE);
Serial.print("1 1000 FINDPRIMESROUTINE XMIT");
And that's all!
___________________________
Working sample
Here is a bit more lengthy sample for the arduino:
http://servicios.ried.cl/arduino/hp48_la...ounter.pde
That counts boxes: