IR transmission with a palm Sony Clie
Jean Brunet
Posts: 10
Hello,
I search to transmit 4 bytes to a Sony clie.
I try my code (your code exactly) but the bytes are not stable, and I am a negative result.
The IR diode is connecting at the ra.0 pin with a 220 ohm resistor. The other pin of the diode is at the ground.
My code is :
MesHor(0)=64
MesHor(1)=128
MesVert(0)=22
MesVert(1)=222
' emp
I search to transmit 4 bytes to a Sony clie.
I try my code (your code exactly) but the bytes are not stable, and I am a negative result.
The IR diode is connecting at the ra.0 pin with a 220 ohm resistor. The other pin of the diode is at the ground.
My code is :
MesHor(0)=64
MesHor(1)=128
MesVert(0)=22
MesVert(1)=222
' emp
Comments
No responses at my problem.
Can you done me the sequence of the IR trame of PDA Sony cli
You used a code sample to help write your program, correct? Have you tried the code sample without changes to verify that it works?
Thanks, PeterM
It was a long rechearch, but I am learning.
The Sx/B is too slow for this application. I am rewrite the listing in assembly code.
The protocole Irda is :
1 bit start, 8 bits of data, 1 bit stop.
If the bit is set , in Irda it is clear.
The 0 data is only set to 1.
The bit stop is also clear.
The bit start is naturely set to 1.
Timing :
At 38400 the pulse is 6.4 us in a square of 25 us.
The are 10 pulses of 25 us. (the clock)
The program work now with two interrupts timers, and I can read on my Pda a correct result.
I must to ajust the interval between two frames.
20 ms is correct ?
Jean
By "frames" I assume you mean a start bit, 8 bits of data, and a stop bit, right? If so, you shouldn't need any time between them. I'm not intimate with IRDA, but I assume the data stream timing should be like any UART. As soon as your stop bit is finished, you should be able to generate your next start bit. A normal UART doesn't need extra time between each byte of data, so I assume IRDA works the same.
If you wait 20 ms between bytes, you're throwing away lots of bandwidth. Sending 10 bits (1 start, 8 data, 1 stop) at 38400 means you should be able to send 3840 bytes per second or 1 byte every 1 / 3840 = .00026 sec = 0.26 ms. By pausing 20 ms between bytes, you are throwing away the chance to transmit 20 ms / .26 ms = 76.92 bytes. In other words, you'll only transmit something like 50 bytes per second. Becuase of this, I doubt that waiting 20 ms is correct.
I have another question about your timing. You say you're running at 38400, and that your clock runs at 25 us. However, 1/38400 = .000026041, which means your clock should actually be running at 26 us. While you can get away with some error in serial communications, this slower clock may be part of the problem in trying to communicate with the Clie.
Thanks, PeterM
Your mail is very interressant.
Y am appy that it'is possible to transmit two frames (a start bit, 8 bits of data, and a stop bit, I confirm ) in a little space of time.
1/38400 = .000026041. Yes, of course ! Also the pulse is 1/4 of 26 us = 6.5 us. My interrupt code is a 1 us int period. 7 us is also good.
Look my interrupt code, with two timer :
sb tf_square ; if set
jmp :st
inc Sq_freq ; time square pulse 26 us
snz
jmp :tf_end ; finish
sb Ir_set ; if set
jmp :no
setb IrPin ; bit Tx Irda
inc Freq_Tir ; time pulse 7 us
sz
jmp :st ; end of pulse
:no clrb IrPin ; pulse 7 us terminate
clrb Ir_set ; flag end of pulse
mov Freq_Tir,#Freq_BitIr ; time pulse
jmp :st
:tf_end clrb tf_square ; end of square pulse
mov Sq_freq,#Freq_SqIr ; time square pulse
:st
The same code permit a bit set or a bit clear if Ir_set flag is true or false.
In a main code
Ir_NoModulate
clrb Ir_set ; signal off / or On if Ir_set is set.
setb tf_square ;
:I2 snb tf_square ; when interrupt code is finish....
jmp :I2
ret
And the trame :
trame
call Ir_Modulate ; start bit
mov idx,#8
:t0 sb temp0.0
jmp :no
call Ir_NoModulate ; if bit set, no modulation
skip
:no call Ir_Modulate
clc
rr temp0
decsz idx
jmp :t0
clc
call Ir_NoModulate ' stop bit
ret
Thank's
Jean