Pulse Width Modulation - reading from TSOP

General discussion on mikroPascal.
Post Reply
Author
Message
AndAway
Posts: 29
Joined: 04 Mar 2009 16:35

Pulse Width Modulation - reading from TSOP

#1 Post by AndAway » 04 Mar 2009 16:55

Hi forum
I'm new to programming PICs. I used to write programs in Pascal for PC.
I've read topics about RC5 but still I don't understand much of it.
My project uses TSOP to read some 0 and 1. As far as I understand the program needs to use interrupt procedure to handle this as it is time critical so i should connect it to RB0/INT0, right?

The format of signal is consisted of:
1. The header pulse of 4 periods of carrier signal 'high' - (it shoult be 4 periods so that program 'have time' to start reading)
2. Then comes zeroes (1 period of carrier signal) and ones (2 periods of carrier signal)
3. Between bits there is 1 period of no carrier signal

Whole data packet is consisted of header pulse and 2 bytes and the program should write those 2 bytes into a variable.
So how can I do the timings (measure if the comming bit is 1 or 0)? Can I read those 0 and 1 just by stating that variable:= PortB.0 ?
There is a simmilar post about reading a digital calliper but it uses spi.
Please help me to understand the scale of the problem.

Post Reply

Return to “mikroPascal General”