Missing the SLEEP function for URC-7562 Extender.

Support forum for extenders. If you're having trouble getting one up and running, this is the place to come.

Moderator: Moderators

Post Reply
Lasse
Posts: 5
Joined: Wed Jul 28, 2004 4:16 am

Missing the SLEEP function for URC-7562 Extender.

Post by Lasse »

Hello all I have a URC-7562 with Extender. The problem is that the
Extender don't support the original remotes SLEEP function.

To solve this I'm trying to create a protocol who could behave like
a delay of aprox 15 minutes to use in a macro. The delay is working
fine but I need a function call to check if any button is pressed to
be able to interrupt the delay.

I will also be greatful if some one could give the code to flash
the "HOME_THEATER" button instead of the traditional buttons.

A list with all the useful ROM subroutines should also be nice.

/Lasse

;Sleep protocol for URC-7562
;signature EBV0EBV1

ORG FF00
DB 0,0
DB 0
CALL $367A ; flash LED once
LD RC3, R03 ; argument in 15 sec intervalls
Main:
LDW RC0, $0000
LD RC2, $DC
Loop:
DJNZ RC0, Loop
DJNZ RC1, Loop ; aprox 70 msec
; CALL ReadKey ; is any button pressed?
; JRC Exit ; yes, exit
DJNZ RC2, Loop
CALL $367A ; flash LED every 15 sec
DJNZ RC3, Main
JR Done
Exit:
CALL $188F ; flash LED twice
Done: RET
Nils_Ekberg
Expert
Posts: 1689
Joined: Sat Aug 02, 2003 2:08 pm
Location: Near Albany, NY

Post by Nils_Ekberg »

Most of the critical ROM calls are actually in the extender .asm file so you may be able to dig more out of there. To list all the ROM calls would be massive.

The following is how to test for a key pressed.

Code: Select all

WaitKey:	IDLE		            ; wait for interrupt
           TM	R89,#$A0	      ; was a key pressed or did a timer expire?
           JREQ WaitKey          ; no, repeat
           DI
           TM R89, #$80          ;test to see if a key was pressed
           JRNE KeyPressed       ; yes
Lasse
Posts: 5
Joined: Wed Jul 28, 2004 4:16 am

SLEEP interupt key

Post by Lasse »

OK Thanks,
I will test the Interupt sequence but I need to add a timer to don't get stuck waiting for the interupt!
/Lasse
Lasse
Posts: 5
Joined: Wed Jul 28, 2004 4:16 am

Key red don't work

Post by Lasse »

Hi Nils,
I have tested a lot of variants but can't get any button pressed results!

I have to add a timer if not I hang until a key is pressed.
If I don't clear the R89 Flag register at the begining of the code I just exit directly. If clear it I never get any key pressed flag?

Any suggestions?

Thanks in advance
/Lasse


ORG FF00
DB 0,0
DB 0
CALL _LED1
LD RC3, R03 ; argument in 15 sec
; AND R89, $7F ; clear keyflag IF not this I exit direct
Main:
LDW RC0, $0000
;LD RC2, $DC
LD RC2, $80
Loop:
; DJNZ RC0, Loop
; DJNZ RC1, Loop; aprox 70 msec
;*******************
LD R4A, $01 ; delay time
CALL 1A23H ; start_timer
IDLE ; wait for interrupt
TM R89,#$A0 ; was a key pressed or did a timer expire?
JREQ NextMove ; no, continue
DI
TM R89, #$80 ;test to see if a key was pressed
JRNE Exit ; yes Exit!!!
NextMove:
;*******************
DJNZ RC2, Loop
CALL _LED1 ; flash every 15 sec
; OR R89, $80 ; set keyflag If I do this I exit after one loop
DJNZ RC3, Main
JR Done
Exit:
CALL _LED2 ; flash LED twice
Done: RET
Nils_Ekberg
Expert
Posts: 1689
Joined: Sat Aug 02, 2003 2:08 pm
Location: Near Albany, NY

Post by Nils_Ekberg »

Let me digest your code and see what I can come up with
Lasse
Posts: 5
Joined: Wed Jul 28, 2004 4:16 am

Post by Lasse »

I have tested a lot of code pices so far. could it be a register conflict (Push/Pop)? Do you have any subrutins to monitor/debug the result from the ROM calls? As you se I havent take the time to learn the S3C8 CPU yet! I just start to peek and poke around.

/Lasse
Lasse
Posts: 5
Joined: Wed Jul 28, 2004 4:16 am

Post by Lasse »

Hi Nils,
I have figure out how to detect a "key press". The solution is to read the key scanncodes not the interrupt! The following code works fine on URC 7562 with extender.
/Lasse

; Sleep protocol for URC-7562 (2004-08-05 Lars P)
; works only with Extender "7560ext"
; new firmware (signature EBV0EBV1)

; Device: FC 00 01 TV 1105

; Key Moves: TV Phantom1 TV 1105 $3C $02 (15 min delay, run last macro ->PopDev)

; Macro: SLEEP -> PushDev;TV;Phantom1;TV;Power;AUD;Power;PopDev

; 15 minute delay any key breaks. $xx $yy (R03,R04)
; xx=delay in 15 sec intervals $3C=15 minutes.
; yy=key interupt mode $00=stop macro $01=run macro $02=run last macro.

; Upgrade protocol 0 = 01 FC (S3C80, new fw.)

ORG FF00

DB 0,0
DB 0
CALL BlinkHT
LD RC3, R03 ; argument in 15 sec intervals
LD RC4, R04 ; argument exit mode 00=stop macro 01=run macro 02=run last macro
Main:
LDW RC0, $0000
LD RC2, $B8 ; aprox 15 sec
Loop:
DJNZ RC0, Loop
DJNZ RC1, Loop; aprox 70 msec
; CALL BlinkHT ; debug!
PUSH RC2
CALL $0761 ; scan keypad with debounce, KeyCode in R82 (world?)
POP RC2
; LD RC3,R85 ; debug!
; CALL BlinkCode ; debug!
CP R85,#01H ; is there one key pressed?
JREQ Exit ; Yes, Bye !!!
DJNZ RC2, Loop
CALL BlinkHT ; flash every 15 sec
DJNZ RC3, Main
JR Done
Exit:
DEC RC4
JREQ Done ; 01 argument continue macro
LD R6E, R6F ; set macro pointer to end of macro
DEC R6E ; macro end
DEC RC4
JREQ ExBlink ; 02 argument last macro
INC R6E ; macro end
ExBlink:
CALL BlinkAll
Done:
LD R85,#01H ; Simulate one key pressed! To continue Macro ?
RET


; *** Subroutines ***
Delay:
PUSH RC0
PUSH RC1
PUSH RC2
LDW RC0, #0000H
Loop:
DJNZ RC0, Loop
DJNZ RC1, Loop
DJNZ RC2, Loop
POP RC2
POP RC1
POP RC0
RET

BlinkAll:
CLR RE4; All LED's ON
LD RE4, #40H; All LED's ON (not bit 6 Home Theater)
JR DoBlink
BlinkHT:
LD RE4, #BFH; LED BIT 6 ON (Home Theater)
DoBlink:
PUSH RC2
LD RC2, #06H ; Delay time
CALL Delay ; delay
LD RE4, #FFH; LED's off
POP RC2
RET

;BlinkCode:
; *** DEBUG MONITOR Call with value in RC3 ***
; *** pause, blink A times, pause, blink B times, ***
; *** pause, blink C times, pause, blink D times ***
; LD RE4, #FFH ; LED's OFF
; LD RC5, #04H ; 4 blinking nible loop
;NextNible:
; RL RC3
; RL RC3
; LD RC2, #10H ; Delay time
; CALL Delay ; delay
; LD RC2, RC3
; AND RC2, #03H
; INC RC2
; CALL 1891H ; blink active LED
; DJNZ RC5, NextNible
; RET

; 00 00 00 F6 FF 5D 38 03 48 04 C6 C0 00 00 2C B8
; 0A FE 1A FC 70 C2 F6 07 61 50 C2 A6 85 01 6B 09
; 2A EE F6 FF 5D 3A E3 8B 12 00 C4 6B 0E E4 6F 6E
; 00 6E 00 C4 6B 02 20 6E F6 FF 56 E6 85 01 AF 70
; C0 70 C1 70 C2 C6 C0 00 00 0A FE 1A FC 2A FA 50
; C2 50 C1 50 C0 AF B0 E4 E6 E4 40 8B 03 E6 E4 BF
; 70 C2 2C 06 F6 FF 3F E6 E4 FF 50 C2 AF
Post Reply