David,
I just found your code, I think I am going to use it (maybe it needs some modification) for sending an RC5 signal to a Philips TV. I found a good description of RC5 here: infrared
Check my post on implementing an RC5 transmitter (seems like it should do what you want):