Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

IrDa PROJCT USING PIC16F690

Status
Not open for further replies.

wavestorm1986

New Member
Good day to all

we want to work on a project related to infrared transmitter and receiver, means:

1- there will be two PIC16F690 for transmitter and receiver and each should be programed in C-language

2- the transmitter should have the ability to one the Air-Condition using infrared.

3-if we leave the remote control for long period should go into SLEEP mode.

until now the progress is we will add PWM and every one knows that the frequency should be 40Khz and the source code for it working, we did small circuit for the reviver and we used the remote control of the Air-Con to test the pattern using the oscilloscope, by the way we have to add sound while pressing the button, and the reviver that we are using is KSM-603LM.

thanx for any help


Regard's :rolleyes:
 

Attachments

  • KSM-603LM IR Receiver.pdf
    200.5 KB · Views: 390
Last edited:
i hope i can get help in my source code here, as i said before we are destining an infrared circuit with all the above required 1,2,3
so we stuck in a very noob things and i do not know how to proceed i think the problem is in the DATA[10] ARRAY coz the loop will still there never go into ELSE. we are using MPLAB and HI-TECH C,thanx in advance
 

Attachments

  • modulation..c
    1.9 KB · Views: 193
Yes, you have a problem with your loops. You have a FOR loop for the array index, but inside that is the WHILE loop that loops indefinitely. So the FOR loop only executes once and never increments "i".
 
the idea was to if we press a button to send the data stream then it will go into DATA[10] otherwise it will be out or will not execute anything...

can you please it you didn't mind to correct it coz i didnt get what you mean ???

thanx for your help....
 
You've told the PIC to do something 10 times.
But then inside that something you've told it to do something else forever.
It never leaves the WHILE loop, so it never increments "i"...the counter stays at 0.

Look at it this way. I tell you to run 10 laps around the track. But I tell you that before you finish each lap you have to run around the universe. How many times will you run around the track?

Mike
 
ohhhhh means will not finish 1 lap at all

Correct.

As was stated by a previous poster, the while loop inside the for loop trapped the execution of your code the first time through the for loop. There was no condition by which the code could have exited the while loop because 1 is always true. I have no idea if this change will make your code work the way you want it to, but at least now it will iterate through the for loop.

Code:
//====================================================================================================
//	include
//====================================================================================================
#include <pic.h> 

//====================================================================================================
//	configuration
//====================================================================================================
__CONFIG (INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT & BORDIS);

//====================================================================================================
//	Define
//====================================================================================================

//===================================================================================================
//	Function Prototype
//===================================================================================================

	
//===================================================================================================
//	main function
//===================================================================================================
void main(void)
{
	
		unsigned i;
		char DATA[10] ={1, 1, 0, 1, 0, 0, 1, 1, 0, 1};
		ANSEL = 0x00; // Set PORTC as Digital I/O
		TRISC = 0x00;
		CCP1CON = 0b00001100;			//PWM Mode
		
		//PWM frequecy set as 38KHz
		PR2 = 0x19;						//PWM Period Setting 24
		T2CON = 0b00000100;				//Timer2 On, prescale 1
		
		while(1){						//Infinity Loop	
			
		//Modulation
		for (i = 0; i < (sizeof(DATA)); i++){

			if (DATA[i]=1)
			{
				CCPR1L = 13;
			}
			
			else if (DATA[i]=0)
			{
				CCPR1L=0;
			}
			}//end for
		}//end infinity loop			
}//end main


//==============================================================================================
//	functions
//==============================================================================================
 
Last edited:
ok thanx for all the helps, i did a good progress, i will post my source code and i need to do a sleep mode means if i press on the button the remote will be deactivated and goes into sleep so can i know whats the way to test it or in other word to test the CURRENT ????


THANX IN ADVANCE
 

Attachments

  • ir5..c
    1.9 KB · Views: 190
guys plzzzz we need help here, we are now comparing between the remote control for the air-con and our transmitter on the same receiver and we got phase difference, but the pattern is almost the same only the phase. we tried to ON and OFF the air-con it WORKS but not always, means from 10 times we tried only 3 times works...

i will post the photo from the oscilloscope hope anyone can help us.....


thanx in advance

hint: pic1= remote control
pic2= out transmitter
 

Attachments

  • 1..jpg
    1..jpg
    51.1 KB · Views: 219
  • 2..jpg
    2..jpg
    49.5 KB · Views: 240
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top