need help to solve muting problem in code"

A

alibaba

hi,
the problem is tat when i stand further from the tv,the muting
should be turn off but it does not turn off ,instead the word normal
appear on the tv and wait there forever,cant turn off the mute.
oblem to unmute my sony tv .my project is using infra distance sensor
to mute and unmute the tv,no buttons r required if input(pin_A3) is
high,the tv is mute ,if the input(pin_A3) is low,the tv is unmute but
my unmuting part is incorrect as the word normal keep on appearing on
the screen and the standby light on the sony tv is blinking repeatedly
when i add the unmute(); which is the reset command in the else loop
with delay_ms(1000).I do not know what is wrong with my programming.My
project should work this way,when i stand near the sensor ,the tv is
mute ,red led is turn off but when i stand further away the tv ,the tv
should be unmuted straighaway,red led is turn on and IR is turned
off.Please help me think of a solution on the unmuting part.THanks!
 
A

alibaba

hi,
   the problem  is tat when i stand further from the tv,the muting
should be turn off but it does not turn off ,instead the word normal
appear on the tv and wait there forever,cant turn off the mute.
oblem to unmute my sony tv .my project is using infra distance sensor
to mute and unmute the tv,no buttons r required if input(pin_A3) is
high,the tv is mute ,if the input(pin_A3) is low,the tv is unmute but
my unmuting part is incorrect as the word normal keep on appearing on
the screen and the standby light on the sony tv is blinking repeatedly
when i add the unmute(); which is the reset command in the else loop
with delay_ms(1000).I do not know what is wrong with my programming.My
project should work this way,when i stand near the sensor ,the tv is
mute ,red led is turn off but when i stand further away the tv ,the tv
should be  unmuted straighaway,red led is turn on and IR is turned
off.Please help me think of  a solution on the unmuting part.THanks!
Below is the programming code for my prj.
#include<16F84A.H>
#fuses HS,NOWDT,NOPROTECT,PUT
#use DELAY(clock=20000000)

#define RED_LED
PIN_B3//(OUTPUT) RED led(TRUE)

#define RED_LED_ON output_low
(RED_LED)
#define RED_LED_OFF output_high
(RED_ LED)

#DEFINE pulse
PI_B2
#define pulse_high
output_low(pulse)
#define pulse_low
output_high(pulse)

#use fixed_io(b_output=PIN_B2,PIN_B3)
#use fast_IO (b)
use fast_IO (a)

#byte OPTION_REG=0x81
#bit PS0=OPTION_REG.0
#bit PS1=OPTION_REG.0
#bit PS2=OPTION_REG.0
#bit PSA=OPTION_REG.0
#bit T0SE=OPTION_REG.0
#bit T0CS=OPTION_REG.0
#bit INTEDG=OPTION_REG.6
#bit RBPU=OPTION_REG.7

Void send1_600()
{
pulse_high;
delay_us(14);
pulse_low;
delay_us(14);


pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);



pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);
pulse_high;
delay_us(14);
pulse_low;
delay_us(14);


pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14);

pulse_high;
delay_us(14);
pulse_low;
delay_us(14)
}

Void_send1_1200()
{
send1_600();
send1_600();
}

Void_send_srart_2400()
{
send1_1200();
send1_1200();
}

Void_send_0_600()
{
pulse_low;
delay_us(602);
}

Void mute() //this is the mute command
{
RED_LED_OFF;
send_start_2400();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_1200();
send0_600();
send1_600();
send0_600();
send1_1200();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_1200();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
dalay_ms(25);
}

Void unmute() //this is the reset command
{
RED_LED_OFF;
send_start_2400();
send0_600( );
send1_600( );
send0_600( );
send1_1200( );
send0_600( );
send1_1200();
send0_600();
send1_600();
send0_600();
send1_1200();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_1200();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
send1_600();
send0_600();
dalay_ms(25);
}

Void main(void)
{
//set_ tris_b(0xc2);
Set_tris_b(0xe0);
Set_tris_a(0x0c);

//RBPU=0;


while(1)
{
if(input(PIN_A3))
{
mute();
}
Else
{
Unmute();
Delay_ms(1000);
pulse_low;
}

}

}
 
T

Thad Smith

alibaba said:
Below is the programming code for my prj.
[Snip CCS code for a PIC processor]

This is better addressed in comp.arch.embedded.

[off topic]
If you have determined that you are sensing the distance correctly, then your
problem appears to be that the IR code being sent to unmute is incorrect. If
you have access to an IR detector and a storage scope or logical analyzer,
monitor the pulse train of a remote control successfully performing an unmute,
then adjust your code accordingly. Compare the output of your code with the
corresponding output of the remote.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top