After some time of idleness i got to work again on my IR setup. I still have some problem understanding what happens.
This is my setup:
Transmitter: picaxe28x1, IR led (tsal6100)with cathode connected to pwm (%50 duty, 38000Hz), anode to an output pin.
Code:
pwm bla bla (set up of pwm)
pause 500
pulsout 7, 250
Receiver: picaxe28a, IR receiver and demodulator (tsop1238) properly connected.
Code:
debug
main:
pulsin INPUT_PIN, 0, w0
goto main
-----
I get strange result every time i switch the transmitter on.
Sometimes the results i get are more than one and i don't understand why (i switch on the transmitter, and on the debug appear 2 or 3 different values like 249, which is approximately correct, then 169(?) and sometimes also something close to 30).
Some other times i just get incorrect values like 169 instead 0f 240. I don't really know what is going on. If i understood well, having a 0 in the "state" field of the pulsin command tells it to begin counting only when a high to low transition occurs (that is, when the receiver sees IR modulated at 38kHz), so if i switch on my transmitter this transition only occurs once. But then why do i get more than one rresult? And why do i sometimes get incorrect ones?
strange...(for me)