need help to solve muting problem in code"

Discussion in 'C Programming' started by alibaba, Jan 31, 2010.

  1. alibaba

    alibaba Guest

    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!
     
    alibaba, Jan 31, 2010
    #1
    1. Advertising

  2. alibaba

    alibaba Guest

    On Jan 31, 4:06 am, alibaba <> wrote:
    > 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;
    }

    }

    }
     
    alibaba, Jan 31, 2010
    #2
    1. Advertising

  3. alibaba

    Thad Smith Guest

    alibaba wrote:
    > On Jan 31, 4:06 am, alibaba <> wrote:
    >> 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.

    ....
    >> off.Please help me think of a solution on the unmuting part.THanks!

    > 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.

    --
    Thad
     
    Thad Smith, Feb 1, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura
    Replies:
    2
    Views:
    363
    Miguel Dias Moura
    Jun 19, 2004
  2. emy86evil
    Replies:
    1
    Views:
    497
    emy86evil
    Nov 21, 2006
  3. Witless

    A problem to solve..need help

    Witless, Jul 10, 2004, in forum: C Programming
    Replies:
    5
    Views:
    316
    RoSsIaCrIiLoIA
    Jul 11, 2004
  4. kris
    Replies:
    9
    Views:
    801
    Manish Pandit
    Sep 13, 2007
  5. RaulGonz
    Replies:
    7
    Views:
    377
    Jerry Coffin
    Sep 3, 2009
Loading...

Share This Page