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
    I will like to make at least 40x80 like this....
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    There is no reason why we can't use TWO ports for data 16 bit data That would speed things up..
     
  3. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Last edited: Apr 7, 2013
  4. dave

    Dave New Member

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


     
  5. koolguy

    koolguy Active Member

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

    Please what the problem all rows and portb is connecteda s you said!!
    but it is not working!
     
  6. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    What isn't working? My code on your hardware?... My code wasn't intended for your hard ware.... To run that code you'll need to re wire your rows for every forth row..
     
  7. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Yes i have re-wire/updated as you suggested in previous post...
    and you were saying of inverting the data in port B...
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    No.. That was in ISIS... The 8x8 matrix needed inverting....

    According to the video, it seems to be nearly there... I would just recheck the wiring. the rows need to be like this to the shift registers..

    ....1...2....3...4... // row 1
    ....5...6....7...8...
    ...9...10..11..12..
    ...13..14..15..16..
    ..
    ..
    ...21..22..23..24.. // row 8
     
  9. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    hi
    i have connected in this way the 8x32 led with 74164...
     
  10. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Do me a quick schematic and I'll get my code to work on your hardware..
     
  11. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Here it is.......
     

    Attached Files:

    • sd.jpg
      sd.jpg
      File size:
      59.1 KB
      Views:
      108
  12. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    I thought so... Mines the other way round.. Scans from left to right... That's why you get reversed characters..
     
  13. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    So, i know again i have to change the hardware can't we change this from code?
     
  14. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Not really... The rows are just pulsed in sequence... Its the shift registers that control the row being updated...

    If you write an algorithm that only supplies the correct data for each row pulse... Then your screen refresh routine will be inside the interrupt... And that's not good..
     
  15. koolguy

    koolguy Active Member

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

    I have done this but the problem is not solved don't know why???

    and if we see the fault with the help of ball there are total 6 led for it which like this ' ", don't know whats the problem??
     
  16. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Are you using my un-changed code?... What shift registers are you using again?

    I want to change my program to suit those shift registers..
     
  17. koolguy

    koolguy Active Member

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

    I am using your code and 74164 registers....
     
  18. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    OK!! I have changed the shift registers to the 74ls164's It works just as good

    matrix3.png

    Check my connections with yours....
     
  19. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Hi again,
    I am using NPN transistor at port B with sinking that mean it is reversing the signal so, need to be changed by code!
     
  20. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Just change a line in the interrupt.

    Code (text):
    PORTB = buffer[displayPointer];
    to
    Code (text):
    PORTB = ~(buffer[displayPointer]);
    This will invert the output.
     
  21. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I am working on it...
    i found that after scanning left to right i found the character mirror..
    like this L is coming |- i mean to say on top...
    so, the scanning should be from bottom now???
     

Share This Page