This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Make ADE7169F16 rising ADE_ISR().

Hi folk,

Would you like show me an example, how can I set ADE7169F16 rising ADE_ISR() interrupt subroutine.

Thanks & Best Regards,

Cuong,

Parents
  • #include<reg51.h>
    
    void send_seg(int,int,int,int);
    unsigned char n=1;
    unsigned char thou=2,hun=0,ten=0,single=6;
    unsigned char a[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
    void DelayMs(unsigned char);
    
    void main()
    {
    
            P0=P2=0;
            while(1)
            {
                    send_seg(thou,hun,ten,single);
            }
    }
    
    void send_seg(int thou,int hun,int ten,int single)
    {
    if(n==1)
            {
            P0=0x08;
            P2=a[single];
            n=2;
            DelayMs(5);
            }
            else if(n==2)
                    {
                            P0=0x04;
                            P2=a[ten];
                            n=3;
                            DelayMs(5);
                    }
                    else if(n==3)
                            {
                            P0=0x02;
                            P2=a[hun];
                            n=0;
                            DelayMs(5);
                            }
                    else
                    {
                            P0=0x01;
                            P2=a[thou];
                            n=1;
                            DelayMs(5);
                    }
    }
    
    void DelayMs(unsigned char Ms)
    {
            int i;
            for(i=0;i<Ms*48;i++);
    }
    

Reply
  • #include<reg51.h>
    
    void send_seg(int,int,int,int);
    unsigned char n=1;
    unsigned char thou=2,hun=0,ten=0,single=6;
    unsigned char a[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
    void DelayMs(unsigned char);
    
    void main()
    {
    
            P0=P2=0;
            while(1)
            {
                    send_seg(thou,hun,ten,single);
            }
    }
    
    void send_seg(int thou,int hun,int ten,int single)
    {
    if(n==1)
            {
            P0=0x08;
            P2=a[single];
            n=2;
            DelayMs(5);
            }
            else if(n==2)
                    {
                            P0=0x04;
                            P2=a[ten];
                            n=3;
                            DelayMs(5);
                    }
                    else if(n==3)
                            {
                            P0=0x02;
                            P2=a[hun];
                            n=0;
                            DelayMs(5);
                            }
                    else
                    {
                            P0=0x01;
                            P2=a[thou];
                            n=1;
                            DelayMs(5);
                    }
    }
    
    void DelayMs(unsigned char Ms)
    {
            int i;
            for(i=0;i<Ms*48;i++);
    }
    

Children