Hello Alain,
This is an example of a 13-bit IR pattern I measure on a TSOP4838 receiver module.
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2701&stc=1&d=121464754 0">
At the start, my prog captures the incoming pattern sent continiously until it determines the starting-bit (first one after the pause between two patterns) and the number of bits (Bit-Count) in the pattern.
I try with this code:
Code:
for Ctr_A = 0 to bit_count
rctime p_in, 0, h_Bit[Ctr_A]
rctime p_in, 1, l_Bit[Ctr_A]
next Ctr_A
' Results are:
Bit 00 Low :13795
00 High :350
Bit 01 Low :244
01 High :1253
Bit 02 Low :244
02 High :349
Bit 03 Low :243
03 High :350
Bit 04 Low :244
04 High :350
Bit 05 Low :244
05 High :349
Bit 06 Low :244
06 High :349
Bit 07 Low :243
07 High :350
Bit 08 Low :75
08 High :1
Bit 09 Low :244
09 High :650
Bit 10 Low :243
10 High :350
Bit 11 Low :244
11 High :350
Bit 12 Low :244
12 High :349
This is the code (works fine) I use currently use @ 20MHz and the data I get with PULSIN is:
Code:
for Ctr_A = 0 to bit_count
pulsin p_in, 0, L_Bit[Ctr_A]
next Ctr_A
for Ctr_A = 0 to bit_count
pulsin p_in, 1, H_Bit[Ctr_A]
next Ctr_A
' Resuts are:
Bit 00 Low :1258 'to be multiplied by 2µs (PULSIN res @ 20MHz)
00 High :247
Bit 01 Low :354
01 High :247
Bit 02 Low :354
02 High :247
Bit 03 Low :355
03 High :247
Bit 04 Low :354
04 High :247
Bit 05 Low :354
05 High :247
Bit 06 Low :354
06 High :247
Bit 07 Low :354
07 High :247
Bit 08 Low :655
08 High :247
Bit 09 Low :354
09 High :247
Bit 10 Low :355
10 High :247
Bit 11 Low :355
11 High :247
Bit 12 Low :354
12 High :13797
According to your previous message, I might raise the timings accuracy with RCTIME instead of using PULSIN. Unfortunately, I can't get it to work using RCTIME.
What am I doing wrong, please?
Bookmarks