Luc Pauwels

Using your HP28S as a Remote Control

Michiel Niemeijer & Eric Toonen

A lot of people who have the HP28S are currently changing to the HP48SX. If you decide not to sell your classic-28 (and maybe this article will convince you not to) you can use it very easy as an intelligent remote control.

Description:

This is an application for the HP28S, Version 2BB, to send the infrared signals as supported by all PHILIPS (and daughter-firms like ARISTONA) remote controlable machines. These machines range from tape-recorders to satelite-tuners. This code is commonly known as RC5 code.

The RC5 code:

The RC5 code is an 13-bit code, it used to have a 5-bits group and a 6-bits command, and 2 stop-bits, but it was changed to 5-bits group, 7-bits command and 1 stop-bit.

The HP28S led:

The HP28S's infrared led is normally used to send data to a HP printer, using a code used (as far as I know) for HP only. Internally, this code is timed using the real-time clock. The infared led is turned on or off, by accessing address #FFF0Dh the contents is: #2h turns the led on, #0h turns the led off.

All we have to do now, is have a machine-code routine time and access the led. To keep this code short and simple (Life is short and RAM is full), we do NOT use the real-time-clock. Therefore, DO NOT USE FAST together with RC5.

The assembly listing:

	; RC5 sender
	; In:  Level 1: pt
	; Out: -

	; ROM-routines used:
	SAVER	EQU	#05081h		;Save registers
	CONTN	EQU	#1B505h		;Restore regs & continue RPL
	GETPT	EQU	#04F27h		;Read pt from stack in A

	; MIO-addresses used:
	IRLED	EQU	#FFF0Dh		;IR-led: #2h=On, #0h=Off

8F18050		CALL.A	SAVER		;Save registers
8F72F40		CALL.A	GETPT		;Read value from stack
1BD0FFF		MOVE.5	IRLED,D0	;point to ledvalue
30D		MOVE.P1	#Dh,C		;Send (Counter=13) bits
816		RRN.W	C

C4	L1:	ADD.A	A,A		; 1 or 0 ?
5E0		BRCC	L2

7120		CALL.3	L4		;Send 1-bit
7420		CALL.3	L5
6B00		JUMP.3	L3

7C10	L2:	CALL.3	L5		;Send 0-bit
7110		CALL.3	L4

	L3:	;Next bit
A4E		DEC.S	C		;Decrement Counter
53E		BRCC	L1		;All done?

7700		CALL.3	L4		;Turn led off
8D505B1		JUMP.A	CONTN		;Restore regs & return to RPL

	L4:	;Led Off
300		MOVE.P1	#0h,C		;Put(0)
6600		JUMP.3	L6

	L5:	;Led On
302		MOVE.P1	#2h,C		;Put(2)
		;JUMP.3	L6

	L6:	;Put(c)
1540		MOVE.P	C,(D0)		;set led
3182		MOVE.P2	#28h,C		;wait
A6E	L7:	DEC.B	C
5CF		BRCC	L7
01		RET			;return

		END
Make this into an `inline machine code', and store it in the variable 'SEND.OBJ'
+---"For example"-"(HEXIFY and CHT were posted by Alonzo Gariepy)"---+ | | | "8F180508F72F401BD0FFF30D816C45E ;do not include newlines | | 0712074206B007C107110A4E53E77008 | | D505B1300660030215403182A6E5CF01" | | | | 'SEND.STR' STO ;chk [A27F] | | SEND.STR HEXIFY #2C96h CHT ;make 'inline' | | 'SEND.OBJ' STO | | 'SEND.STR' PURGE | | | +--------------------------------------------------------------------+

The RPL listing:

	'GROUP'
	0
	
	'RC5' [7BFA]
	<< IP 128 MOD
	  IF DUP 64 <
	  THEN 12288			;RC5?
	  ELSE 8192			;or Extended RC5?
	  END SWAP 64 MOD +
	GROUP IP 32 MOD 64 *		;GROUP is a variable with the
	+ DUP				;      groupcode
	  IF OLD SAME			;OLD is made by RC5
	  THEN 4096 +
	  END DUP 'OLD' STO
	64 * SEND
	>>

	'SEND' [6B0C]
	<< DUP TYPE
	  IF NOT
	  THEN # C53Bh			;0CB35   real->pt
	SYSEVAL SEND.OBJ
	  END DROP
	>>

How to use it:

First, set the group-number of the device you want to control. This is done by STOring the number (in range 0..31) in 'GROUP'.

You send data to the device by entering a command number (a real in range 0..127) and press RC5 ...

The commands:

These are the codes as they are given in the PHILIPS service document ``Survey remote control transmitters CTV sets''.