Code for Osmart brand XBox DVD Remote
Moderator: Moderators
Hey guys. I had a question for ya.
If I want to do a
LDW RRF8,#00E0H
CALL 0158H
Is there a better way to do that? I mean, I don't need a whole word to load that byte. It seems like I could cut down the size of the protocol if I could just do an LD, though I don't know what the function expects.
Please let me know if there's a better way to call sleep for a smaller interval like this.
Thanks for all the help!
If I want to do a
LDW RRF8,#00E0H
CALL 0158H
Is there a better way to do that? I mean, I don't need a whole word to load that byte. It seems like I could cut down the size of the protocol if I could just do an LD, though I don't know what the function expects.
Please let me know if there's a better way to call sleep for a smaller interval like this.
Thanks for all the help!
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
That statement is the same as loading zeroes to RF8 and #E0h to RF9. If you were to just do the load to RF9 you would not be able to guarantee that RF8 would contain zeroes.Flavor wrote:Hey guys. I had a question for ya.
If I want to do a
LDW RRF8,#00E0H
CALL 0158H
Is there a better way to do that? I mean, I don't need a whole word to load that byte. It seems like I could cut down the size of the protocol if I could just do an LD, though I don't know what the function expects.
Please let me know if there's a better way to call sleep for a smaller interval like this.
Thanks for all the help!
If you're looking to conserve code space, I notice that you are using an inner loop (of 255) and an outer loop (of 4) to send that delay. A better option might be to increase the delay time by a factor of 4 and do away with the outer loop.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Yeah, I realize that RF9 will be random until I initialize it. Will any of the other calls mod RF9? I am doing something a little new, and if I could zero RF9 once and then set RF8 from then on, it would be smaller.The Robman wrote: That statement is the same as loading zeroes to RF8 and #E0h to RF9. If you were to just do the load to RF9 you would not be able to guarantee that RF8 would contain zeroes.
Actually, I am using an inner loop of 255 and a ONE-TIME outer loop of 4. That makes the time between the initial signal and the second signal 4 times longer than the following repeats.The Robman wrote: If you're looking to conserve code space, I notice that you are using an inner loop (of 255) and an outer loop (of 4) to send that delay. A better option might be to increase the delay time by a factor of 4 and do away with the outer loop.
Also, any time you're in that delay, it makes the remote less responsive. So, making the loop variable larger and making the delay time smaller has a positive effect on the protocol.
In fact, my next protocol update actually does
Code: Select all
CALL 010AH
JRNC END
LDW RRF8,#0038H
CALL 0158H
CALL 010AH
JRNC END
LDW RRF8,#0038H
CALL 0158H
CALL 010AH
JRNC END
LDW RRF8,#0038H
CALL 0158H
CALL 010AH
JRNC END
LDW RRF8,#0038H
CALL 0158H
Code: Select all
CALL 010AH
JRNC END
LDW RRF8,#00E0H
Code: Select all
LD RF9,#00
CALL 010AH
JRNC END
LD RF8,#38H
CALL 0158H
CALL 010AH
JRNC END
LD RF8,#38H
CALL 0158H
CALL 010AH
JRNC END
LD RF8,#38H
CALL 0158H
CALL 010AH
JRNC END
LD RF8,#38H
CALL 0158H
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
If you were to switch your outer loop to 255 repeats and your inner loop to 4, instead of adding all that code, you could simply increase the inner loop to 16 and reduce the delay time.
Also, you have the registers backwards, when you load #0038H into RRF8, RF8 will end up zeroes and RF9 will contain "38".
Also, you have the registers backwards, when you load #0038H into RRF8, RF8 will end up zeroes and RF9 will contain "38".
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
But, that 4 loop only happens one time. The first time you press the button, it runs the loop 1020 times. After that, it only runs it 255 times.The Robman wrote:If you were to switch your outer loop to 255 repeats and your inner loop to 4, instead of adding all that code, you could simply increase the inner loop to 16 and reduce the delay time.
The real reason that I unrolled it to 4 calls is that I plan to test a 3-level repeating. So, when you hit the key, the first delay is N uSec, then the next 10 repeats are N/4 uSec apart. Finally, if you keep holding it down, it speeds up to N/8 (or maybe N/16) uSec per repeat. I could use another (3rd) loop for this, or I could unroll it to 2-4 calls. I'm not sure which is better, and it'll take some testing before I decide.
Thanks! That's a good catch! I would have been scratching my head for a bit on that.The Robman wrote:Also, you have the registers backwards, when you load #0038H into RRF8, RF8 will end up zeroes and RF9 will contain "38".
Here's my latest. I don't really plan to tweak it anymore.
I'm calling this Version 12 because my own numbering got up to 12.
Upgrade protocol 0 = 01 DF (S3C8+) GBX #12-4 (PB v3.12)
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 B0 C5 F6 01 46 F6 01 46 C6 F8 00 38 A6 C5 00
6B 09 A6 C5 0A 2B 08 4C 02 8B 07 4C 10 8B 02 4C
04 5E 6C FF 70 C4 F6 01 0A 50 C4 FB 09 F6 01 58
6A F2 4A EE 8B CD AF
End
It does 3-level repeating. It goes 1X for the initial press, then 4X for the next 9 repeats, and then 8X after that. If you want something really similar to the original, then I suggest you go back and use Version 8. I like this 3-level repeat more than the original, so that's why I did it. I have some large directories to scroll through in XBMC, so it's nice to be able to kick it up to a higher gear after a bit.
I'm calling this Version 12 because my own numbering got up to 12.
Upgrade protocol 0 = 01 DF (S3C8+) GBX #12-4 (PB v3.12)
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 B0 C5 F6 01 46 F6 01 46 C6 F8 00 38 A6 C5 00
6B 09 A6 C5 0A 2B 08 4C 02 8B 07 4C 10 8B 02 4C
04 5E 6C FF 70 C4 F6 01 0A 50 C4 FB 09 F6 01 58
6A F2 4A EE 8B CD AF
End
Code: Select all
DB 3DH,90H ;38.3 kHz 30%
DB 51H ;5 dev, 1 cmd
JR LFF17
DB 85H ;pf0: 10000101=1-dev,1-cmd,dev-cmd
DB 24H ;pf1: 00100100=LI-same,LI-LO
DB 08H ;pd00: DevBits1=8
DB 05H ;pd01: CmdBits1=5
DW 030CH ;pd02/03: 1-burst on=1560 uS
DW 00F0H ;pd04/05: 1-burst off=520 uS
DW 0104H ;pd06/07: 0-burst on=520 uS
DW 02F8H ;pd08/09: 0-burst off=1560 uS
DW 0DACH ;pd0A/0B: Leadout off=7000 uS
DW 0104H ;pd0C/0D: Leadin on=520 uS
DW 00F0H ;pd0E/0F: Leadin off=520 uS
LFF17: LD W1,DCBUF+5
AND RC1,#07H
LD W2,#03H[W1]
LD DCBUF,W2
CLR W5 ;init the counter
XMIT: CALL XMITIR
CALL XMITIR
LDW RRF8,#0038H
CP W5,#00H ;check for first press
JREQ FIRST
CP W5,#0AH ;how many times before level 3
JRLE SECOND
LD W4,#02H ;third level waits this long (half of lvl 2)
JR W4LOOP ;but no longer increments
FIRST: LD W4,#10H ;4 times slower than level 2
JR INCW5
SECOND: LD W4,#04H ;level 2
INCW5: INC W5 ;increment the counter
W4LOOP: LD W6,#FFH ;Do the main waitloop FF times every time
W6LOOP: PUSH W4
CALL 010AH
POP W4
JRNC END
CALL 0158H
DJNZ W6,W6LOOP
DJNZ W4,W4LOOP
JR XMIT ; XMIT again
END: RET
It does 3-level repeating. It goes 1X for the initial press, then 4X for the next 9 repeats, and then 8X after that. If you want something really similar to the original, then I suggest you go back and use Version 8. I like this 3-level repeat more than the original, so that's why I did it. I have some large directories to scroll through in XBMC, so it's nice to be able to kick it up to a higher gear after a bit.
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
Could you post the PB file also please.
http://www.hifi-remote.com/forums/dload ... &cat_id=42
http://www.hifi-remote.com/forums/dload ... &cat_id=42
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
When I test this protocol using my URC-8910, it still doesn't repeat. Could you load your IR image to the Diagnosis Area so I can load it directly into one of my 15-2104 remotes to test it.
Btw, are you using PUSH and POP because the W4 register was getting overlaid? Did you try and other registers?
Btw, are you using PUSH and POP because the W4 register was getting overlaid? Did you try and other registers?
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
I am doing the push/pop because it doesn't work without it. I had tried some other registers, but I didn't know which were safe to use. I had bad luck with the couple I tried, so I just left it at push/pop. If you know of another one that doesn't get clobbered, obviously that would make the protocol smaller.
Here's my .ir file.
http://www.hifi-remote.com/forums/dload ... le_id=2456
Here's my .ir file.
http://www.hifi-remote.com/forums/dload ... le_id=2456
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
OK, this is totally weird. I loaded your IR file into my 15-2104 and it does indeed repeat properly, but if I load the same upgrades into a URC-8811 or a URC-8910 the signal doesn't repeat at all.
So, something about your protocol isn't global enough to work on all remotes and so far I haven't spotted what it is.
Maybe there's something weird about the 15-2104 which is the reason why all my earlier protocols looked fine to me but didn't work for you.
So, something about your protocol isn't global enough to work on all remotes and so far I haven't spotted what it is.
Maybe there's something weird about the 15-2104 which is the reason why all my earlier protocols looked fine to me but didn't work for you.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Well, I think my logic is pretty good, but maybe the function calls are a little different between the remotes. Maybe on some remotes the functions clobber different registers. Like John said that W4 wouldn't get modified, but it obviously does on my remote.
You might try a push/pop for the other registers around the calls.
Also, you might notice that I have my sleep calls set to (LDW RRF8,#0038H). I noticed that if I divide it in half down to 1C and double the W4 loop variables, then it doesn't work, anymore. Maybe there's something weird there, too.
I'd say that if it doesn't repeat, then it's staying in the loop forever. It's probable that W4, W5, or W6 is getting messed up during the loop and any of the 3 calls could be doing it. I had a version with a lot of push/pops, but I whittled it down to just W4 around that one call.
You might try a push/pop for the other registers around the calls.
Also, you might notice that I have my sleep calls set to (LDW RRF8,#0038H). I noticed that if I divide it in half down to 1C and double the W4 loop variables, then it doesn't work, anymore. Maybe there's something weird there, too.
I'd say that if it doesn't repeat, then it's staying in the loop forever. It's probable that W4, W5, or W6 is getting messed up during the loop and any of the 3 calls could be doing it. I had a version with a lot of push/pops, but I whittled it down to just W4 around that one call.
-
The Robman
- Site Owner
- Posts: 21889
- Joined: Fri Aug 01, 2003 9:37 am
- Location: Chicago, IL
- Contact:
If it was staying in the loop the remote would lock up with the red LED lit up, so it's obviously exiting too soon.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Yeah, you're probablly right about that, then. Though, I think that the only thing that exits the loop is the "JRNC END." The only other thing that I think could exit my code is if the stack gets screwed up.
Also, I was originally going to modify the sleep time, but I never actually implemented that. So, it might be good to move the "LDW RRF8,#0038H" to immediatly before the "CALL 0158H" so that you know for sure that nobody else mods it. Though, I can't see why that would make it exit the loop.
Does my Version 8 work for you, or does that exhibit the same problem?
Also, I was originally going to modify the sleep time, but I never actually implemented that. So, it might be good to move the "LDW RRF8,#0038H" to immediatly before the "CALL 0158H" so that you know for sure that nobody else mods it. Though, I can't see why that would make it exit the loop.
Does my Version 8 work for you, or does that exhibit the same problem?
Just FYI, here are some differences between your Ver4 code and my Ver8/12 code.
On yours, RC6 is incremented every time XMITIR is called. I assume that XMITIR doesn't do anything with RC6, and I assume that the other functions don't need to see this register incremented.
You loaded RRF8 with a value MUCH higher than I used. I assumed that it didn't matter, but maybe some remotes need it to be over a certain value.
Your code doesn't push/pop W4 and it uses it as a loop variable. On my remote, that didn't work. Perhaps there's something different between our remotes, and we should use a different register instead of W4.
Are there other registers that are good to use instead of W4, W5, and W6?
I gotta run for a bit now, but I'd sure like to figure out what's up with this.
On yours, RC6 is incremented every time XMITIR is called. I assume that XMITIR doesn't do anything with RC6, and I assume that the other functions don't need to see this register incremented.
You loaded RRF8 with a value MUCH higher than I used. I assumed that it didn't matter, but maybe some remotes need it to be over a certain value.
Your code doesn't push/pop W4 and it uses it as a loop variable. On my remote, that didn't work. Perhaps there's something different between our remotes, and we should use a different register instead of W4.
Are there other registers that are good to use instead of W4, W5, and W6?
I gotta run for a bit now, but I'd sure like to figure out what's up with this.