1. 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.
    Dismiss Notice

LCD display flickrign problem. Urgent help required.

Discussion in '8051/8951' started by Qaisar Azeemi, Mar 13, 2012.

  1. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    please also tell me how much delay will this routine produce with 12MHz crystal?

    Code (text):

    #include <reg51.h>
                       
    sbit led=P0^0;

    void delay(msec)
    {
    int i,j;
        for (i=0;i<msec;i++)
            for (j=0; j<1275; j++);

    }

    void main()
    {
    led=1;
    delay(100);
    led=0;
    delay(100);

    }
     
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    each iteration is about 9mS so with a delay(100) approx 900 mS...

    We have been here before.... j<142 = 1ms... the j loop took 7 cycles... 7 * 143 = 994uS + the i loop take another 7 cycles .. 1001uS
     
  3. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,249
    Likes:
    1,218
    Location:
    Cardiff, Wales
    With VREF+ being connected directly to Vcc any ripple or noise on the Vcc rail will affect the A/D conversion. VREF+ requires decoupling from Vcc by RC filtering components.
    The LED drive transistors should each have a resistor (say 10k) between base and emitter to ensure they turn off completely.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,179
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE

    hi alec,
    This image shows what the d/s says about Vref decoupling.

    E.
     
  6. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,249
    Likes:
    1,218
    Location:
    Cardiff, Wales
    Thanks, Eric. That discusses decoupling the analogue inputs and Vref/2 pin. Can't see any Vref/2 pin on the schematic. Is it the same as VREF+ ?
     
  7. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    Vref+/2 is the refrance pin of ADC0804.
     
  8. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    plz check my this routine... i want to select one output at a time. just like rotation of 4 bit data (1000B). but it is giving random selection; with interrupt signal all bits goes high and then any one bit got selected randomly.... i dont know what acctually the problem is???????
    Code (text):
    #define select P3

     sbit v28=select^4;
     sbit v14=select^6;
     sbit v7=select^5;
     sbit off=select^7;


        void switching() interrupt 0
               {

                        if(count==0)
                            {
                                 off=0;  v7=1; v28=0; v14=0;
                                 count++;
                            }
                        else   
                        if(count==1)   
                            {
                                v7=0; v14=1; v28=0; off=0;
                                count++;
                            }
                        else
                        if(count==2)
                            {
                                v14=0; v28=1; v7=0;  off=0;
                                 count++;
                            }

                        else
                            {
                           
                                count=v28=v14=v7=0; off=1;
                               
                            }



                    /*  if(v28==0 && v14==0 && v7==0 && off==1)
                            { off=0;  v7=1; v28=0; v14=0; }
                       
                        else
                            if(v28==0 && v14==0 && v7==1 && off==0)
                                  { v7=0; v14=1; v28=0; off=0; }
                       
                        else
                            if(v28==0 && v14==1 && v7==0 && off==0)
                                  { v14=0; v28=1; v7=0;  off=0; }
                       
                        else
                           { v28=v14=v7=0; off=1; }  */
                           
               
               }
    and here is the immage of my circuit.

    View attachment 62237
     
    Last edited: Mar 16, 2012
  9. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    any help about my prevous post please??
    during interrupt all the bits of port 3 got high and after interrupt it selects any one of the bit High Randomly.. not according to coad..... :( ... how to solve this problem..???
     
    Last edited: Mar 17, 2012
  10. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    problem solved :)
     
  11. Qaisar Azeemi

    Qaisar Azeemi Member

    Joined:
    Oct 24, 2011
    Messages:
    157
    Likes:
    1
    Location:
    South of Asia
    the problem is solved :)

    the problem was with the interrupt.. we must force the interrupt to go high in order to disable it.. so it will be able to select the required pin correctly....

    i am very thank ful to all who help me.

    best regards
    Qaisar azeemi
     

Share This Page