Traffic signal/7 segment display

Thread Starter

Maliha

Joined Dec 17, 2013
2
I know I am jumping in from no where but thought it would be helpful.The thing is that I am new to PIC 16F877A and have made this simple code on PROTON IDE which is abt controlling 2 traffic signals and running a counter at the same time. Its running fine but implementing it on PROTEUS is a little issue.I am not sure how make connections for a 7 segment common anode display and my ports are not turning on when i burn my software.Its a very small problem but i would appreciate if somebody from among those who replied to this thread helps with the connections in Proteus. I just need the connections for Proteus for this code on PROTON IDE. Please reply I would be highly obliged.

Rich (BB code):
'****************************************************************
'*  Name    : 2 way Traffic Lights Control                      *
              'and 7 segment display.BAS                        *
'*  Author  : [Maliha Arif]                    *                *
'*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 12/12/2013                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'                                                               *
'****************************************************************
    Device=16F877A
    XTAL 20
    TRISC=0        'Declaration: All port C pins as output
    TRISD=0        'Declaration: All port D pins as output
    
    main:
    
    PORTD=%00100001         'Red LED (1st pole) ON,Green LED (2nd Pole) ON
              
    
    PORTC=%01000000         'Digit 0       '7 segment Display**
    DelayMS 100            ' 1s
    PORTC=%11111001         'Digit 1
    DelayMS 100            ' 1s
    PORTC=%00100100         'Digit 2
    DelayMS 100           ' 1s
    PORTC=%00110000         'Digit 3
    DelayMS 100            ' 1s
    PORTC=%00011001         'Digit 4
    DelayMS 100           ' 1s
    PORTC=%00010010         'Digit 5
    DelayMS 100            ' 1s
    PORTC=%00000010         'Digit 6
    DelayMS 100           ' 1s
    PORTC=%11111000         'Digit 7
    DelayMS 100            ' 1s
    PORTC=%00000000         'Digit 8
    DelayMS 100            ' 1s
    PORTC=%00010000         'Digit 9
    DelayMS 100            ' 1s
    
    
    PORTD=%00010010         'Yellow LED(both poles) ON
    
    
    PORTC=%01000000         'Digit 0            '7 segement Display**
    DelayMS 100          ' 1s
    PORTC=%11111001         'Digit 1
    DelayMS 100            ' 1s
    PORTC=%00100100         'Digit 2
    DelayMS 100           ' 1s
    PORTC=%00110000         'Digit 3
    DelayMS 100            ' 1s
    PORTC=%00011001         'Digit 4
    DelayMS 100            ' 1s
    PORTC=%00010010         'Digit 5
    
    
    PORTD=%00001100         'Green LED(1st pole) ON,Red LED(2nd pole) ON
    
    
    PORTC=%01000000         'Digit 0         '7 segement Display**
    DelayMS 100            ' 1s
    PORTC=%11111001         'Digit 1
    DelayMS 100            ' 1s
    PORTC=%00100100         'Digit 2
    DelayMS 100            ' 1s
    PORTC=%00110000         'Digit 3
    DelayMS 100            ' 1s
    PORTC=%00011001         'Digit 4
    DelayMS 100            ' 1s
    PORTC=%00010010         'Digit 5
    DelayMS 100            ' 1s
    PORTC=%00000010         'Digit 6
    DelayMS 100            ' 1s
    PORTC=%11111000         'Digit 7
    DelayMS 100            ' 1s
    PORTC=%00000000         'Digit 8
    DelayMS 100            ' 1s
    PORTC=%00010000         'Digit 9
    DelayMS 100            ' 1s
    
    GoTo main
 
Last edited by a moderator:
Top