View previous topic :: View next topic |
Author |
Message |
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Tue Jan 15, 2008 9:40 pm Post subject: Pause protocol with cancel? |
|
|
Hi All,
Is it conceptually possible to create a version of the pause protocol that can be canceled on a button press?
Without knowing this particular assembler, it looks like the protocol just delays using opcodes rather than a timer or something - can I just insert a check to see if a button has been pressed somehow?
I use it to do a commercial skip timer and it would be useful to be able to cancel when a tricky short commercial break comes on.
Thanks,
xnappo |
|
Back to top |
|
|
Nils_Ekberg Expert
Joined: 02 Aug 2003 Posts: 1689 Location: Near Albany, NY |
Posted: Wed Jan 16, 2008 9:58 am Post subject: |
|
|
All of the pause protocols that I am familiar with use the same routine to do the pause. The routine is one that is built into the remote and simply sits in a loop doing nothing based on a numeric time value that is set in the special protocols in IR and passed to the routine. A quick review of the routine shows no way to interrupt it until the timer expires.
However, what it really sounds like you are asking for is how to interrupt the macro sending the command to the device not the pause.
Post what the macro looks like and we can see if we can come up with a recommendation. _________________ Nils
Files Section
Diagnosis File Section |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Wed Jan 16, 2008 10:07 am Post subject: |
|
|
Hmm, the pause protocol I am using is not using anything built into the remote. Here is the code:
FF00: 00 00 DB 00H, 00H
FF02: 01 DB 01H
FF03: E4 03 C2 LD RC2, R03
FF06: C6 C0 00 00 LDW RC0, #0000H
FF0A: 0A FE DJNZ RC0, FF0AH
FF0C: 1A FC DJNZ RC1, FF0AH
FF0E: 2A FA DJNZ RC2, FF0AH
FF10: AF RET
Here is my macro:
FWD
FWD
FWD (go to 3x FWD)
SHIFT-L2 (pause protcol call)
PLAY
Looking at the pause protocol, it seems like if there were a register I could read that indicates a button has been pressed, then I could check for that in between the DJNZs and jump to FF10 if a button press has occured.
Thanks,
xnappo |
|
Back to top |
|
|
Nils_Ekberg Expert
Joined: 02 Aug 2003 Posts: 1689 Location: Near Albany, NY |
Posted: Wed Jan 16, 2008 10:26 am Post subject: |
|
|
I was looking at the pause protocols that are supplied with the extenders and you are using the generic one. If you tell me what remote you are using I will see if there is a register to test. _________________ Nils
Files Section
Diagnosis File Section |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Wed Jan 16, 2008 12:32 pm Post subject: |
|
|
Nils_Ekberg wrote: | I was looking at the pause protocols that are supplied with the extenders and you are using the generic one. If you tell me what remote you are using I will see if there is a register to test. |
Thanks Nils,
I am using a URC-9910 with extender 1.
xnappo |
|
Back to top |
|
|
mr_d_p_gumby Expert
Joined: 03 Aug 2003 Posts: 1370 Location: Newbury Park, CA |
Posted: Wed Jan 16, 2008 1:25 pm Post subject: |
|
|
The extender protocols call internal routines, and sometimes do not work correctly because of that. The generic pause you are using does the timing locally. There is no register that you can check, but you could call an internal routine to check if the key is still down. If the carry bit is set upon return, then a button is still down.
CALL 010Ah
JRC xxxx _________________ Mike England |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Wed Jan 16, 2008 5:03 pm Post subject: |
|
|
mr_d_p_gumby wrote: | The extender protocols call internal routines, and sometimes do not work correctly because of that. The generic pause you are using does the timing locally. There is no register that you can check, but you could call an internal routine to check if the key is still down. If the carry bit is set upon return, then a button is still down.
CALL 010Ah
JRC xxxx |
Thanks a lot - will give it a try this weekend - but just a clarification - will the carry bit be set only if one keeps holding the button, or if a button has been pressed and not yet executed?
What I want to do is press my 'com skip' button and release - then while in the pause macro if any button is pressed exit the loops...
xnappo |
|
Back to top |
|
|
mr_d_p_gumby Expert
Joined: 03 Aug 2003 Posts: 1370 Location: Newbury Park, CA |
Posted: Wed Jan 16, 2008 9:03 pm Post subject: |
|
|
xnappo wrote: | just a clarification - will the carry bit be set only if one keeps holding the button, or if a button has been pressed and not yet executed?
What I want to do is press my 'com skip' button and release - then while in the pause macro if any button is pressed exit the loops... | Normally, the routine is only used to see if a button is still down (carry set) or not (carry clear). I've never tried using it in this circumstance, and there are some variations in the way this is implemented in various remotes, so I can't say if it will work in all cases, but it's worth a try. My hunch is that if you call it often enough you should be able to catch an un-debounced button depression. _________________ Mike England |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Sat Jan 19, 2008 11:30 am Post subject: |
|
|
Bummer, doesn't seem to work. I tried a few different combinations. Putting the check between every count seemed to make it pause forever. Here is what I think should work - but it doesn't seem to recognize key presses:
FF00: 00 00 DB 00H, 00H
FF02: 01 DB 01H
FF03: E4 03 C2 LD RC2, R03
FF06: C6 C0 00 00 LDW RC0, #0000H
FF0A: 0A FE DJNZ RC0, FF0AH
FF0C: F6 01 0A CALL 010AH
FF0F: 7B 04 JR C, FF15H
FF11: 1A F7 DJNZ RC1, FF0AH
FF13: 2A F5 DJNZ RC2, FF0AH
FF15: AF RET
Does that look right? Is R03 the value passed in to the protocol?
BTW - kudos to Mark or whoever wrote the built in disassembler in IR - makes it really easy to just write in microcode.
Thanks,
xnappo |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Fri Jan 25, 2008 3:38 pm Post subject: |
|
|
xnappo wrote: | Bummer, doesn't seem to work. |
Not to be annoying and ping... But anyone have any other ideas?
Thanks,
xnappo |
|
Back to top |
|
|
Nils_Ekberg Expert
Joined: 02 Aug 2003 Posts: 1689 Location: Near Albany, NY |
Posted: Fri Jan 25, 2008 4:02 pm Post subject: |
|
|
Try these
Code: | CALL 3EADH (debounced key)
JRNC FF15H
CALL 3E8FH
CP R83,#01 (;Exactly one key pressed)
JRNE FF15H |
_________________ Nils
Files Section
Diagnosis File Section |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Sat Jan 26, 2008 10:41 am Post subject: |
|
|
Thanks Nils. The first one didn't work, but the second is CLOSE!
Using it as you posted makes it immediately exit - so I changed the JRNE to JREQ (which makes sense?)
But... Now it exits the pause if I hit a button, but if I *don't* hit a button it pauses 'forever'. I thought maybe it was just due to the extra opcodes, but I waited a long time (3 minutes) and it still didn't exit.
I assume the CALL opcode saves the registers to the stack? Or is RC2 getting corrupted? Here is the code right now:
Code: | FF00: 00 00 DB 00H, 00H
FF02: 01 DB 01H
FF03: E4 03 C2 LD RC2, R03
FF06: C6 C0 00 00 LDW RC0, #0000H
FF0A: 0A FE DJNZ RC0, FF0AH
FF0C: 1A FC DJNZ RC1, FF0AH
FF0E: F6 3E 8F CALL 3E8FH
FF11: A6 83 01 CP R83, #01H
FF14: 6B 02 JR EQ, FF18H
FF16: 2A F2 DJNZ RC2, FF0AH
FF18: AF RET |
Thanks a lot,
xnappo |
|
Back to top |
|
|
Nils_Ekberg Expert
Joined: 02 Aug 2003 Posts: 1689 Location: Near Albany, NY |
Posted: Sat Jan 26, 2008 11:47 am Post subject: |
|
|
RC2 is definitely corrupted and will always equal something after coming back from the CALL. Sorry I didn't notice that.
Try this:
Code: | TM R87,#80
JREQ FF18H |
I think R87 will not conflict and if equal to #80 it should mean any button was pressed. _________________ Nils
Files Section
Diagnosis File Section |
|
Back to top |
|
|
xnappo Expert
Joined: 30 Dec 2003 Posts: 861
|
Posted: Sat Jan 26, 2008 11:47 am Post subject: |
|
|
Sweet! I got it to work. I had to save off RC2. Here is what I did - is there a more elegant way?
Code: | FF00: 00 00 DB 00H, 00H
FF02: 01 DB 01H
FF03: E4 03 C2 LD RC2, R03
FF06: C6 C0 00 00 LDW RC0, #0000H
FF0A: 0A FE DJNZ RC0, FF0AH
FF0C: 1A FC DJNZ RC1, FF0AH
FF0E: E4 C2 03 LD R03, RC2
FF11: F6 3E 8F CALL 3E8FH
FF14: A6 83 01 CP R83, #01H
FF17: 6B 05 JR EQ, FF1EH
FF19: E4 03 C2 LD RC2, R03
FF1C: 2A EC DJNZ RC2, FF0AH
FF1E: AF RET |
Thanks for your help Nils and Mike!
xnappo |
|
Back to top |
|
|
Nils_Ekberg Expert
Joined: 02 Aug 2003 Posts: 1689 Location: Near Albany, NY |
Posted: Sat Jan 26, 2008 11:50 am Post subject: |
|
|
In my opinion, if it works it is elegant.
You could just try the last test and see if that works and if not go with what you got to work. _________________ Nils
Files Section
Diagnosis File Section |
|
Back to top |
|
|
|