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.

PWM on a PIC

Status
Not open for further replies.
Its for my surround sound not a TV... And The Command is 0x00 for the 1 button and the device code which i assume to be the address is 0x0D
 
AtomSoft said:
Its for my surround sound not a TV... And The Command is 0x00 for the 1 button and the device code which i assume to be the address is 0x0D

Presumably this is a Sony SIRC's remote?, as you say the numeric button codes are one less than their labelled value.

I've not seen a device ID of 0x0D, it wasn't amongst the remotes I tested, but is perfectly possible.
 
maybe its my code tho .. you are right i think.. I have to work from 8am to 1 pm today thats like only 5 hours so its time to leave now. Ill try a tv code soon then when i get hom but i need to buy a universal (cheap like $3.99 in the 99Cent stores in NY lol. maybe $5 but heh its cheap and worth the cause :D Thanks so far for the help everyone!
 
Nigel Goodwin said:
Presumably this is a Sony SIRC's remote?, as you say the numeric button codes are one less than their labelled value.

I've not seen a device ID of 0x0D, it wasn't amongst the remotes I tested, but is perfectly possible.

This is my remote....
https://esupport.sony.com/US/perl/model-home.pl?mdl=RMU304&LOC=3


So how is the code standing as is? Do you think with the correct code it would possibly work?
 
I have a remote for a Sony HiFi which sends device 13 (0x0d) when Tuner is selected. It also sends 18 for Amp and 17 for CD. The cursor keys always send 18 no matter what device is selected.

Have you tried my Swordfish code (scroll down a bit) to read your remote?

Mike.
 
AtomSoft said:
Its for my surround sound not a TV... And The Command is 0x00 for the 1 button and the device code which i assume to be the address is 0x0D

The output from the LA verifies that the code is good.

The Sony info Bill linked to has the address of surround as 12 decimal. Give that a try...

If not do as Mike suggested and listen to the current remote to see what it is sending. But I have not seen any bad info on the sony remotes.
 
Ok this is getting me mad :( this is my code:
Code:
// 37.7kHZ PWM IR carrier signal
#include <p18f1320.h>
#include <delays.h>
#pragma config WDT = OFF,OSC = INTIO2,LVP = OFF

void Delay10TCYx(PARAM_SCLASS unsigned char);
void Delay100TCYx(PARAM_SCLASS unsigned char);
void Delay1KTCYx(PARAM_SCLASS unsigned char);
void Delay10KTCYx(PARAM_SCLASS unsigned char);
void MyL0(void);
void MyL1(void);

void main(void) {    

    OSCCON=0x72; // speed up the clock to 8MHz
    ADCON1 = 0; 
    TRISBbits.TRISB3 = 0;
    PR2 = 0b00110100 ;
    T2CON = 0b00000100 ;
    CCPR1L = 0b00011010 ;
    CCP1CON = 0b00011100 ;

    while(1) {
///////////////////////////////////////
//////// Start Bit
/////////////////////////////////////////
		CCPR1L = 0x1A; // Start
		CCP1CON = 0x1C ; // 50%
		Delay1KTCYx(4);
		Delay100TCYx(8);

		CCPR1L = 0x00; //Space
		CCP1CON = 0x0C ; // 0%
		Delay1KTCYx(1);
		Delay100TCYx(2);

//////////////////////////////////////////
///////// Command Code
////////////////////////////////////////

		MyL0();
		MyL0();
		MyL1();
		MyL0();
		MyL0();
		MyL1();
		MyL0();

////////////////////////////////////////////
///////// Below is DEVICE CODE
///////////////////////////////////////////

		MyL1();
		MyL0();
		MyL0();
		MyL0();
		MyL0();

//////////////////////////////////////////////
//////// Just a wait to restart send /////////
//////////////////////////////////////////////
		Delay1KTCYx(4);
     }    
}
void MyL0(void){
		CCPR1L = 0x1A; // 0
		CCP1CON = 0x1C ; // 50%
		Delay1KTCYx(1);
		Delay100TCYx(2);

		CCPR1L = 0x00; //Space
		CCP1CON = 0x0C ; // 0%
		Delay1KTCYx(1);
		Delay100TCYx(2);
}
void MyL1(void){
		CCPR1L = 0x1A; // 1
		CCP1CON = 0x1C ; // 50%
		Delay1KTCYx(2);
		Delay100TCYx(4);


		CCPR1L = 0x00; //Space
		CCP1CON = 0x0C ; // 0%
		Delay1KTCYx(1);
		Delay100TCYx(2);
}

To be sure what type of LED should i use..im trying :
https://www.radioshack.com/product/...origkw=infrared&kw=infrared&parentPage=search

Im connecting the Long lead to RB3 and the short to GND. Is this correct?
 
The space is always 0.6mS so you should be sending a 2.4mS on pulse followed by a 0.6mS off pulse as the start bit and then, a one bit is 1.2mS on + 0.6mS off, a zero is 0.6 on + 0.6 off. Your timing seems to be double this. EDIT, just realised your delays are in clock cycles so ignore this.

Here is a good page explaining it.

Is it also your intention to send device code 1 and command 36?

Mike.
 
Last edited:
actually no the device is 1 but the command is more like 18

MyL0();
MyL1();
MyL0();
MyL0();
MyL1();
MyL0();
MyL0();

is actual i tried it in reverse to see lol
 
What value have you got for the emitter resistor. It should be about 14Ω for an LED current of 50mA or 35Ω for 20mA.

You will get better results with a lower duty cycle and higher current.

Mike.
 
Last edited:
It depends on the peak current of the diode. If the peak is 4 times the average then 25% would be a good place to start.

Mike.
 
Just two add my 2cents, you don't need a video camera, you can use any digital camera in preview mode, even your cellphone!

I think they all have a preview mode to see on the lcd what the CCD is looking at, that will see the IR without a video camera or taking a picture:)

-Bac
blueroomelectronics said:
Do you have a video camera? Most of them see IR and will let you see it too. Might be handy.
 
Im using a end delay of 10,000 cycles which is 50 ms... 45ms is recommended in between sends so i added 5 for cleanliness.

I used the cam to see if LED is on and it looks solid..like its doesnt blink but i assume thats because its so fast. Its shows like a slight dim and back on
 
AtomSoft said:
Im using a end delay of 10,000 cycles which is 50 ms... 45ms is recommended in between sends so i added 5 for cleanliness.

I used the cam to see if LED is on and it looks solid..like its doesnt blink but i assume thats because its so fast. Its shows like a slight dim and back on

It should blink, VERY clearly - if it's not then you're not modulating it properly (or at all).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top