Creation date 21.07.2001
Chapter of:
Author(s): hpbaby
Navigator: previous main next
Version:     EN

Best in:1024*768

THE  SIMPLIFIED THEORY

We will see in this chapter, the commands to send and reveive bytes on the serial and infrared port of the hp48. As I told into the Basic system, we got 3 forms of programmation languages.   The basic RPL , the sytem RPL and the assembly language (lthe other langages are the derivative  of the two last).In RPL, the commands to exchange bytes on the serial port and Infrared port are common. 
 

One of the two port has to be selected before the use of such commands:

->Select  under HP48G/GX, in the "transfer"  list under menu I/O:

gx_iosetup_wire.jpg (4589 bytes) -Here we set wire to choose the serial port (for IR , choose Infrared)
-The  protocol can be either Kermit or X/Ymodem
-The format ASC (ASCII text) or BIN (binary)
-The trnsfert rate is here de 9600 bauds
-No parity bit


 

 

 

->Under the HP48 S/SX, inside the submenu setup of the menu I/O
We got the same type of information: IR/WIRE, ASCII/BINARY;baud, parity, checksum type et translate code. (The last two are never changed or used)

 

A - The inputs/Outputs commands in RPL 

1) Emission of a byte or a stringon a port

The command to use is XMIT. The synthax is defined as below:

Action Command
Send hello through a port "hello" XMIT 
Send the A character (or byte) "A" XMIT
Send the character number X with X=0 to 255 X CHR XMIT


 

 

The last action is very usefull. Two comments should be done  on one hand,  XMIT  open the serial port for you (the infrared port nver need to be open) and do not forget to close it behind with CLOSEIO, on the 
other hand the return value is 1 if all is okay else 0.

 

2) Reception of  a charater on a port 

 
a) Active lookup 

 

Action Command
AExtract of X caracthers previously received
(X=1 to 255 character max)
X SRECV


 

 

The SRECV command opens the serial port and fetches charaters into the input buffer. If none is present,  the HP wait  a while (TIMEOUT) and gives either the received characters and the number received or an empty string with 0 (no character received). Moreover, the hp48 is busy during this time and nothing else can be accomplished.

b)  Passive lookup

Open the serial port with OPENIO and use SRECV to extract on the fly the last received characters  (before the input buffer overflow!).

If we force the emission of characters on the other side .(ie the time between two RS232 is reduced), the HP becomes very slow (can not follow the rythm), the busy indicator light on and the HP is in the state of key overflow . There is an special limit of this (serial spawning) we can find, the duration  between two serial frames before the busy flag light on because it  is the duration that gives best serial response times.

When you have finished to transfer datas byte per byte, the best is to closethe manualy port  with CLOSEIO, as you will save your batteries. This action is impossible to do when we overflow the input buffer (buffer) of the hp. 

  •  

     

  •  
  •  

     

  1.  
  2.  


 
 

Basic System:
The hp48 (S/SX/G/GX)
The I/O ports
1) The serial RS232 port
2) The Infrarouge port
3) The port for slot cards
Adaptation: Interfaces
1) RS232
2) IR
Talking : The commands 
1) RPL fundamentals
Stuff required 
1) The toolbox