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 CCS Technical Support

Infrared remote emulation question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
johnnyaction



Joined: 04 Feb 2008
Posts: 1
Location: Florida

View user's profile Send private message

Infrared remote emulation question
PostPosted: Wed Feb 20, 2008 7:03 pm     Reply with quote

||EDIT:||
I think I need to learn how to send a 38khz carrier wave with pwm. I don't know how to do this.
||:End EDIT||
What I am attempting to do: Create a simple custom remote control sender and receiver over IR. I have a good working sender unit with the vishay IR breakout board from sparkfun but I'm having issues sending with a square wave like a normal IR remote control.

The problem I am having is sending IR signals so that they get received as a square wave. When I have a normal LED pulsing on and off at a constant rate when I hook it up to my oscilloscope I see a square wave. Good deal not the problem.

When I replace said normal LED with an IR led and use the following code with a vishay ir receiver breakout ( http://www.sparkfun.com/commerce/product_info.php?products_id=8554 ) reading the output of pin B4 yields nice definable square waves from a normal remote control but from my sending circuit all I get is a little spike and not the saw pattern I was expecting.

I am using 16F628a's with an input on B0 for the IR and an output on B4 for the oscilloscope lead on the receiving unit:
Code:

#include <16F628A.h>
#include <math.h>
#fuses INTRC_IO,NOWDT,PUT,NOLVP
#use delay(clock=8000000)
int16 t0=0;
int16 t1=0;
int8 t0state=0;
int16 t2=0;
int16 multi_plier =0;
int8 mstate=0;
int16 change=0;
int16 servo=80;
int8 servo_state=0;
int8 data1=0;
int8 direction=0;
void main()
{

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8 );
   setup_timer_2(T2_DIV_BY_16,255,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   disable_interrupts(GLOBAL); // all interrupts OFF


//Setup_Oscillator parameter not selected from Intr Oscillotar Config tab

   // TODO: USER CODE!!
while(1){
t0 = get_timer0();
t1 = get_timer1();
//t2= get_timer2();

 
if(input(PIN_B0)==0){
 
 
 
 output_high(PIN_B4);
 
 
}else{
output_low(PIN_B4);

}

}
}



code for the sending unit:
Code:

#include <16F628A.h>
#include <math.h>
#fuses INTRC_IO,NOWDT,PUT,NOLVP
#use delay(clock=4000000)

int16 t0=0;
int16 t1=0;
int8 t0state=0;
int16 t2=0;
int16 multi_plier =0;
int8 mstate=0;
int16 change=0;
int16 servo=300;
int8 servo_state=0;
int8 data1=0;
int8 direction=0;


void delay_zs(int16 t)
{
do
{
delay_us(65500);
} while(--t);
}

void main()
{

  //setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);
   //setup_timer_1(T1_INTERNAL|T1_DIV_BY_8 );
  // setup_timer_2(T2_DIV_BY_16,255,1);
   setup_comparator(NC_NC_NC_NC);
    setup_vref(FALSE);
     //disable_interrupts(GLOBAL); // all interrupts OFF


//Setup_Oscillator parameter not selected from Intr Oscillotar Config tab
//output_low(PIN_B4);
   // TODO: USER CODE!!
while(1){
//t0 = get_timer0();
//t1 = get_timer1();
//t2= get_timer2();



output_high(PIN_B3);
output_high(PIN_B4);
//delay_zs(100);
delay_us(200);
output_low(PIN_B3);
output_low(PIN_B4);
//delay_zs(100);
delay_us(200);

 
 


}
}


Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 4:45 am     Reply with quote

It looks like if the IR Vishay sensor was connected in the wrong way. Re-check it.


Humberto
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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