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

How to use Interrupt in PIC16F877A in C..??

Discussion in 'Microcontrollers' started by koolguy, Jan 14, 2013.

  1. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9

    OK, but what the reason of doing such changes???
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ARRGGHHH... because you wanted row scanning... not column scanning.....
     
  3. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    yes but why are you doing like this. One matrix scanning then another ...
    why not the whole display row, are you scanning
     
  4. dave

    Dave New Member

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


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK

    I am scanning a whole row.. The same as the Graphical LCD T6963C... Ive basically used the same code..

    ___ ___ ___ ___
    | 1 || 2 || 3 || 4 |
    | 5 || 6 || 7 || 8 |
    | 9 || .. || .. || . |
     
  6. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I think you are not getting me in right way....!!
    as you said this what is the advantage of scanning in this way???
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    Because it replicates the bytes stored in an image... When you create animation files for the Toshiba LCD's the pictures are stored the same way..
     
  8. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I am not getting pure reason of doing scanning by this method, are you doing this for good scanning???



    Code (text):
    0x00,0x00,0x00,0x03, //                              **
    0x7F,0x00,0x00,0x0A, // *******                    * *
    0x43,0x00,0x00,0x0B, // *    **                    * **
    0x45,0x00,0x00,0x0A, // *   * *                    * *
    0x59,0x00,0x00,0x0B, // * **  *                    * **
    0x61,0x00,0x00,0x0F, // **    *                    ****
    0x7F,0x00,0x00,0x0F, // *******                    ****
    0x3E,0x00,0x00,0xFD, //  *****                 ***** **

    like this is the image.....
     
  9. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    Yes! It's so you can use the picture above striaght from LCD assistant or fastLCD.... This is the format of their output...

    It makes sense to scan and place pixels in the same order, don't you think....
     
  10. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    OK, now i am getting your scanning tech. what are you trying to do is feeding directly port b to 4 sections of rows(now its clear) but making hardware for this will be complicated Little bit.
    Anyway let us move forward to other part of code logic.....
    Code (text):

    void displaystring(void)                // this routine prints through the screen buffer
        {                                   // moving one pixel at a time
        signed char x=32,y=0;               // I made these signed so I could print
        for(y = 0;y  < 96 ;y++)             // to nowhere so I could produce the scrolling effect
            {
            clr();                          // Clear the display buffer
            strput("HELLO WORLD!!",x--,0);  // adjust the scrolling string
            Blit();                         // pass to screen buffer
            __delay_ms(80);                 // time to view
            }
        }
    signed char x=32,y=0; // I made these signed so I could print
    What do you mean by print here by signed???
    this is also not clar what the of x-- here with 0 and again strput???
     
  11. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    My strput() take three parameters.... char* string... signed char x ... signed char y

    X is the column and y is the row Y is always 0 because I want to print at the top LED row... X is moved as explained.... They are signed so I can go minus....
     
  12. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Code (text):

    void strput(const char* ch, signed char x,signed char y)
        {
        int addr;
       
        while (*ch )
            {
            charput(*ch++,x,y);         // write a string to the display buffer
            x+=7;
            }  

    void charput(char ch, signed char x,signed char y)
        {
        signed char x1, y1;            
        const char* addr2;              // pointer to character
        char disp;
        ch -= 0x20;                     // characters starts a 0 not 0x20
        addr2 = &fnt[0];                // start of font array
        addr2 = addr2 + ((int)ch * 8);  // start place in font array
        for( y1=0;y1<8;y1++)            // eight rows
            {
            disp = *addr2;
            for (x1 = 0; x1<8; x1++)    // eight pixels
                {          
                if(disp & pow[x1])
                    pixel(x+x1,y+y1,0); // OR the pixel to the display buffer
                }
            addr2++;
            }  
        }

    This part also not clear can you me brief intro of your plan of doing adding these things??
    most of word you are using cond msk not getting there use ??
     
  13. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    What???

    Msk is used in the pixel routine... It is so you can write to a location WITH new data without destroying the old data...

    I can place pixel (LED) by pixel resolution so you don't need to shift the data the LED's are lit one by one rather than a complete line ( row )... This is a common way to draw to a screen..
     
  14. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Hi,

    Then there is no use of shift register so, decade counter can be used here...
    and if we make a big display like 32x60 or even more than what changes should be done in it??
     
  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    More shift registers.... But as I said before, you'll end up with LED's so dim you'll struggle to see them...
     
  16. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    This is not the exact answer i think...
    in this code there is no use of shift register and i will connect 74164 with uln2003a Darling ton pair, and can't we do any calculation for making length??
    can't we do // processing for large size of display?
     
  17. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    A decade counter is also a shift register.... It really doesn't matter which one you use as long as the output suits your needs..
     
  18. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    For more than 8 rows should we do // processing for large size of display?
    and PORT B is connected directly to 4 row section???
     
  19. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    What is the ultimate size you're looking to use?
     
  20. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I will like to make at least 40x80 like this....

    and PORT B is connected directly to 4 row section???
    Is this right?
     
  21. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    PORTB is connected to ALL the rows........ The rows are selected 1 though 32 in turn...
     

Share This Page