Jump to content
Sign in to follow this  
squalo

Infrared communication

Recommended Posts

Hello, sorry for my bad english.

i want produce PWM signal in 38khz. (my reciever is tsop1838 and transmitter is TSAL6200). 

Firstly, leds on the reciever side are blink. But a few seconds later, they turn off. What's the problem?

 

My codes:

//Transmitter
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog timer
while(1) {
P1DIR |= 0x0C; // P1.2 and P1.3 output
P1SEL |= 0x0C; // P1.2 and P1.3 TA1/2 options
CCR0 = 12; // PWM Period/2
CCTL1 = OUTMOD_6; // CCR1 toggle/set
CCR1 = 6; // CCR1 PWM duty cycle
TACTL = TASSEL_2 + MC_3; // SMCLK, up-down mode

}
return 0;
}

 

//Rece'ver

 

#include "io430.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD; //Stop WDT
BCSCTL1 = CALBC1_8MHZ; //Set DCO to 8Mhz
DCOCTL = CALDCO_8MHZ;
P1DIR =0xFF;
P1OUT =0x00;
P2DIR &= ~BIT0; 
while(1)
{

if(P2IN == 0x00) // IF IR IS HIGH

{
P1OUT =0xFF;

__delay_cycles(1000000);//GIVE SOME DELAY
}
else
{
P1OUT =0x00;
__delay_cycles(1000000); // GIVE SOME DELAY
}
}

return 0;
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...