CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

IR wireless presenter
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Andrew83



Joined: 16 Sep 2008
Posts: 51

View user's profile Send private message Send e-mail

PostPosted: Tue Oct 28, 2008 7:10 am     Reply with quote

This is the output of the TSO1738 receiver.
http://rapidshare.com/files/158334372/NEC_code_-_TSOP1738_receiver_output.JPG.html
The image was provided using the pickit2 logic analyzer.
Cheers ! Wink
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Tue Oct 28, 2008 12:06 pm     Reply with quote

Andrew,

I think your problem lies here:
Code:
for (ircount=0;ircount<31;ircount++)

then you add:
Code:
if (ircount==32)
         {
               irdone=true;
          }


The variable ircount will never get to 32. In my code, I had put it as one less than the total number of bits I expected to receive. Try setting it to 30.

Also, in the pulse train in the picture, there seem to be 33 bits; the last one being a 'closing' bit (I think).

I don't think you have taken that into consideration. You can assume the closing bit to be a bit0, i.e. the TSOP will be low for 560us, and then high again for 560us. The last few lines of code are for the closing bit itself, but the for loop accounts only for 32 bits; it does not account for the 'low' of the closing bit.

Rohit
Andrew83



Joined: 16 Sep 2008
Posts: 51

View user's profile Send private message Send e-mail

PostPosted: Sat Nov 08, 2008 2:14 am     Reply with quote

Hello Rohit !

I was out of town for a few days and i wasn't able to continue my work on this project. However....now I'M BACK, ALIVE AND KICKING !! Very Happy

So.... i've managed to analize more carefully the data obtained from the pickit 2 logic analizer and come to the following conclusions:

- a "ONE" seems to be represented by a combination of 600 uS LOW and 1,6 mS HIGH
-a "ZERO" seems to be represented by a combination of a 800 uS LOW and 400 uS HIGH

Doing the math, i've come across a 1,2 mS for a "ZERO" and a 2,2 mS for a "ONE" .

First, i've tried to detect only the timing for the zero ( in the sense that if i've detected a 800uS low, then it's a zero, or if i've detected a 600 uS low, then it's a one).

However, this approach (wich in my opinion would be the logical way to go) didn't get me anywhere.

So....i've tried to detect also the high part of a one or a zero.

NO LUCK !!! Crying or Very sad

I don't know what else to try !

Please look at my code http://docs.google.com/Doc?id=ddmwh28z_0dkdq28dr and give me a hint why it isn't working !

Thank you very much !!
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sun Nov 09, 2008 5:47 am     Reply with quote

Andrew:

It seems to me that your tolerances are extremely tight. I think this is one of the reasons for your code not working:
Quote:
#define zero_min_for_zero 800
#define zero_max_for_zero 950
#define zero_min_for_one 600
#define zero_max_for_one 750
#define one_min_for_zero 300
#define one_max_for_zero 500
#define one_min_for_one 1500
#define one_max_for_one 2500
#define start0_min 8000 //no of counts to safely detect a "0" start
#define start0_max 12000 //optimal @1,1 MIPS is 9900
#define start1_min 3000 //no of counts to safely detect a "1" start
#define start1_max 6000 //optimal @1,1 MIPS is 4950


Also, do note that according to the NEC protocol the low (the 'low' happens because the TSOP data is inverted; actually there is a 'high' before each bit) for both bit1 and bit0 is the same length - 560us ( http://www.sbprojects.com/knowledge/ir/nec.htm ). In your definitions for zero_min_for_zero and zero_max_for_zero the equivalent time is (800/1.1)=727us and (950/1.1)=863us respectively. Similarly, you may need to correct, and also broaden the range or counts for proper detection.

I would recommend starting off with the widest possible range that you can accommodate, and then, once it works, narrowing the range to get more reliability.

Rohit
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group