Ubicom SX Infra-Red Input-Output

Universal ( IR ) Remote control tester.

By: Alberto Geraci of BTX Sistemas - Argentina.

This project use the Ubicom SX28 micro controller to made a test of the frequency and the complete wave taken form a IR remote control, could be an TV, Audio, VCR, or any type infrared.

It consist of two parts, one is the hardware or the physical tester and the another one is the software.

The hardware:

First at all we have to consider some points, and they are:

Not all the infrared remote controls have similar characteristics, in fact most of them have different frequency carriers depending of the factory, or the model or the protocol used.

Another point to consider is that depending the trademark or model you can see a considerable difference in the total amount of bits that they transmits after switch is pressed.

So we could said about different codes of IR controls a lot, and this is not the purpose of this article, I'll only name some types, they are:

Codes examples: RECS80, NEC, DENON, SIRCS, RC5, MOTOROLA, etc.

RC5 could be the most popular actually of them, if you want to read more about this, check the elektor electronics magazine numbers 252 and 253.

OK, if you see the tester circuit, you'll see three different IR sensors selected by a 3 pos switch , this lets you to change and choice the better receptor for the remote control under test.

I suggest the Siemens SFH 506-33 for one of them and the Telefunken TFMS5360 for the second, the last one could be another type that you like to choice.

About the total quantity of bits, the tester will take 60 each test, so it is enough for the most popular IR controls.

The circuit:

I love the SX's micro controllers, love their 50 MIPS, for that reason what better than use them, to measure the frequency of the remote control wave.

The output state of the IR sensor will change from one to zero in a TTL level, the circuit will detect only this in the rb.4 SX pin , ( after a power on or reset ) starting at this point the RTCC register in zero, and while the rb.4 pin no change RTCC will increment by one each 16 times clock ( see option register configuration ) therefore 3.2 uSeg for a 50 Mhz clock, ok, while this happened the "veces" variable will increment by one many times as the RTCC produce an interrupt ( see RTCC interrupt at org 0 ).

So when the rb.4 change his state, we will have in the "veces" variable, the quantity of times that an interrupt occurs and in the "remanente" variable, the remainder of the RTCC register when the input changed the state.

Multiplying "veces" by 256 and adding "remanente" to the result, and then multiplying all this by 3.2 uSeg, we will have the total time width of the pulse.

Repeating this for each transition of the input, we'll have the complete time for the wave transmitted by the remote control.

To conserve the simplicity of the SX software we will not make the multiplications and the addings in that software, instead of that, we will save in the SX memory all the "veces" and all the "remanente" values to send it them to the PC and to be processed by it. ( 120 bytes total )

So we need a RS232 interface in the software, it is made too at org 0 as interrupt, and it has a flag to detect the appropriate interrupt to be used.

Once the all wave was sample and all the values was sent to PC software, a simple led turns on to indicate that the operation was finished and the SX goes in a sleep condition to economize energy.

The test procedure will begin again, until we press the reset switch.

The PC software:

The software not only have a complete RS232 interface to get the values sent by the SX, it also perform comparisons between the wave of the remote control under test and data saved in a data base which collects information about different IR control models, this mean, if you save in the data base information about IR controls tested successfully you'll have more data to compare when you'll check the same trademark and model in the future.

In example model I've put two records in the data base about remote controls in good state. PLEASE SHARE the data base in the future with all people who will use this project, in http://www.sxlist.com or piclist to contact.

The software have two windows where you can see oscillograms of the remote controls wave. One is up and it is only for IR's under test, and the second in down, and it is for IR's located in the software data base.

The software is more simple to use so it has not any help ( only the tips when you move the mouse over a button )

First at all you must click on the PC serial port to be used and the language, then the software begins and you'll need to wait for the banner to move the mouse to some position, after this you're ready to use it.

Check the examples first to know how you'll see the waves in the screen and then you could check some remote control to let the project work.

IT IS IMPORTANT to let the system ( hardware ) take some warm first, I had some differences with the read values immediately taken after power on and some minutes later.

IMPORTANT TOO - You must have the (Microsoft communications control version 6.0) OCX. Control registered in your system.

To finish I want to comment one thing more, if you are not very familiarized with software I need to tell you that this software is NOT made with Visual Basic or C++, it was made with VISUAL FOXPRO version 6.0

It is a not commonly application for foxpro, so for FOXPRO funs……. it is not all lost guys !!!!!.

NOTE about software installation:

You must have no problem with the installation of the software but remember that you need registered the OCX control in your machine.

Perhaps you'll have problems with the language, in the error messages or in the answers "yes and no" in the dialogs, in that case there is two files named "VFP6RENU.DLL and VFP6RESN.DLL" being the first for the English version and the second for the Spanish version of the software, copy the correct file to the folder where you installed it, or to the /WINDOWS/SYSTEM folder, those two files will be not installed by the setup .

NOTE: THE PC SOFTWARE THAT ACOMPANIES THIS ARTICLE IS COMPLETELY FREE ONLY FOR PERSONAL PURPOSES, E.U.L.A. VIOLATIONS WILL BE IN THE CASE THAT YOU USE IT FOR COMMERTIAL PURPOSES.

PC Software:
http://www.sxlist.com/images/sxlist/sxirtest/software.zip

SX Source:

;*****************************************************************************************
; 
; Filename:	Probador de remotos.src
;
; Author:	Alberto Geraci
;		BTX Sistemas	
;		Argentina.
;		
; Revision:	1.01
;
; Freq:		50MHz
;
; Compiled using: SX-Key.
;
; Date Written	: March 16, 2002
;
; Last Revised	: March 20, 2002
;
; Program Description:
;
;		Super Simple !! SX based IR remote control tester
;		Simple project to demostrate the SX power running at 50Mhz
;		working together with a PC serial port.
;		You can see the remote control oscillogram in a PC window, and compare it with another values.
;
; Interface Pins:
;		
;		input	= rb.4	; remote IR sensor input
;		led	= rb.7	; finish send led ( indicates that test is finished )
;*****************************************************************************************
;
		device sx28l,stackx_optionx
		device oscxt5,turbo
		freq 50000000
		reset reset_entry
; I/O definition
tx_pin		 = 	rb.2	; RS232 transmiter pin
;
; Variables
		org 20h
tx_high 	= 	$08
tx_low 		= 	$09
tx_count	=	$0A
tx_divide	= 	$0B
veces		=	$0C	; quantity of times that rtcc pass by 0.
remanente	=	$0D	; remanent of rtcc times value
estado		=	$0E	; are we testing or sending (flag)
temporal	=	$0F	; temporal variable
;
txdivisor 	equ 	32 	; 32 periods per bit
input		=	rb.4	; remote IR sensor input
led		=	rb.7	; finish send led

;
;****************************************************************************************************************
		org 0
interrupt
		sb	 estado.0		; check for the nescesary interrupt needed
		jmp	 testing
rs232		test	 tx_count 		; busy?
		jz	 noisr			; no byte being sent
		dec	 tx_divide
		jnz 	 noisr
		mov 	 tx_divide,#txdivisor 	; ready for next
		stc 				; ready stop bit
		rr 	 tx_high		; go to next bit
		rr 	 tx_low
		dec	 tx_count 		; 
		movb	 tx_pin,/tx_low.6 	; output next bit
noisr		mov 	 w,#-163 		;interrupt every 163 clocks
		retiw
testing		
		cje	 veces,#255,stop_it		
		inc	 veces
		mov 	 w,#-0			;interrupt every 255 clocks
		retiw
stop_it		setb	 estado.1
		mov 	 w,#-0			;interrupt every 255 clocks
		retiw
;****************************************************************************************************************
send_byte	
:wait 		test 	tx_count 			;wait for not busy
		jnz 	:wait
		mov 	tx_high,w
		clrb 	tx_low.7 			; set start bit
		mov 	tx_count,#10 			;1 start + 8 data + 1 stop bit
		ret
;****************************************************************************************************************
; jmp table
save_data	jmp	@savedata
		ret
;****************************************************************************************************************
reset_entry 	mov	 rb,#%00010000 			;init rb // rb.4 remote input
		mov 	 !rb,#%00010000
		clr fsr 				;reset all ram banks
:loop 		setb 	 fsr.4
		clr 	 ind
		ijnz	 fsr,:loop
		mov	 tx_divide,txdivisor
;		mov   	 !option,#%10011111   ; for RS232
		mov   	 !option,#%10010011   ; for RTCC    ( divide by 16 the clock)
		clrb	 estado.0
		clrb	 estado.1
		clrb	 led		      ; tester led off
;****************************************************************************************************************
;****************************************************************************************************************
MAIN
;****************************************************************************************************************
;****************************************************************************************************************
;
		mov	temporal,#30	; will do 30 times the loop ( 30x4 = 120 variables to save in SX memory)
again		snb	input
		jmp	again		; loop while input is in 1 ( waiting for remote signal )
;
		clrb	 estado.1
loop
		mov	veces,#0	
		mov	remanente,#0					
		mov	rtcc,#0
in_zero		snb	input
		jmp	ready		; loop while input is in 0 ( waiting for 0 and saving veces value )
		snb	estado.1
		jmp	end_test
		jmp	in_zero
;
ready		mov	remanente,rtcc	
		call	save_data
;
		mov	veces,#0	
		mov	remanente,#0					
		mov	rtcc,#0
in_one		sb	input
		jmp	ready_d
		snb	estado.1
		jmp	end_test
		jmp	in_one		; loop while input is in 1 ( waiting for 1 and saving veces value )
;
ready_d		mov	remanente,rtcc	
		call	save_data
;
		decsz	temporal
		jmp	loop
;
end_test				; Ready for send to PC the tested values
break
		mov   	 !option,#%10011111 	  ; enabled interrupt for  RS232
		setb	 estado.0
		clr	 fsr
		mov	 temporal,#120	; will do 120 times the loop ( 120 variables to be send to PC )
loop_again
		setb	 fsr.4
		mov	 w,ind
		call	 send_byte
		inc	 fsr
;
		mov	 remanente,#$FF	;	
cagain		mov	 veces,#$FF	;
tagain		nop			;
		nop			;
		nop			; add some delay to let the PC software to get values
		decsz	 veces		;
		jmp	 tagain		;
		decsz	 remanente	;	
		jmp	 cagain		;
;
		decsz	 temporal
		jmp	 loop_again	; loop will send 120 bytes of data to PC by serial port
;
		setb	 led		; tester led on
end_program	sleep
;****************************************************************************************************************
;****************************************************************************************************************
SUBROUTINES
;****************************************************************************************************************
;****************************************************************************************************************
;
savedata
 		setb 	 fsr.4
		mov	 ind,veces	; save the fisrt byte
		inc	 fsr		; increment the data memory location
		mov	 ind,remanente	; save the second byte
		inc	 fsr
		retp
;****************************************************************************************************************
end
;
;  NOTES:
;  english for "veces" = times
;  english for "remanente" = remainder
;


Interested:

Questions:

Comments: