Menu

7 seg display

Help
2007-09-15
2013-05-30
  • Nobody/Anonymous

    I am a little confused as to how to use the routines for 7 seg displays. What pin does the CC of the display get connected to if I use the line:

    #define DisplayPortA PORTB

    Can I use one port to drive 4 displays?

     
    • Hugh Considine

      Hugh Considine - 2007-09-15

      If you're using just the one display, connect the CC to the ground pin.

      To use 4 displays, you'll need to wire the cathodes to I/O pins on the PIC, and then set the DisplayCount and DispSelect* constants suitably. If you wire the cathodes to PORTA.0 through 3, set the constants as follows:

      #define DisplayCount 4

      #define DisplayPortA PORTB
      #define DisplayPortB PORTB
      #define DisplayPortC PORTB
      #define DisplayPortD PORTB

      #define DispSelectA Set PORTA.0 off: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 on
      #define DispSelectB Set PORTA.0 on: Set PORTA.1 off: Set PORTA.2 on: Set PORTA.3 on
      #define DispSelectC Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 off: Set PORTA.3 on
      #define DispSelectD Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 off

      The last block of constants connects the first 4 pins on PORTA to either ground (off) or Vdd (on). Each constant is a macro which is called when the matching display is about to be written to. It needs to connect all of the cathodes to Vdd, except for the one that is to be used which must be connected to ground.

      Make sure that you call the DisplayValue and/or DisplayChar routines very frequently! GCBASIC doesn't do this automatically.

       
    • Nobody/Anonymous

      Thanks, appreciate your help.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.