Traffic signal/7 segment display

Discussion in 'Embedded Systems and Microcontrollers' started by Maliha, Dec 17, 2013.

  1. Maliha

    Thread Starter New Member

    Dec 17, 2013
    2
    0
    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.

    Code ( (Unknown Language)):
    1.  
    2. '****************************************************************
    3. '*  Name    : 2 way Traffic Lights Control                      *
    4.               'and 7 segment display.BAS                        *
    5. '*  Author  : [Maliha Arif]                    *                *
    6. '*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
    7. '*          : All Rights Reserved                               *
    8. '*  Date    : 12/12/2013                                        *
    9. '*  Version : 1.0                                               *
    10. '*  Notes   :                                                   *
    11. '                                                               *
    12. '****************************************************************
    13.     Device=16F877A
    14.     XTAL 20
    15.     TRISC=0        'Declaration: All port C pins as output
    16.     TRISD=0        'Declaration: All port D pins as output
    17.    
    18.     main:
    19.    
    20.     PORTD=%00100001         'Red LED (1st pole) ON,Green LED (2nd Pole) ON
    21.              
    22.    
    23.     PORTC=%01000000         'Digit 0       '7 segment Display**
    24.     DelayMS 100            ' 1s
    25.     PORTC=%11111001         'Digit 1
    26.     DelayMS 100            ' 1s
    27.     PORTC=%00100100         'Digit 2
    28.     DelayMS 100           ' 1s
    29.     PORTC=%00110000         'Digit 3
    30.     DelayMS 100            ' 1s
    31.     PORTC=%00011001         'Digit 4
    32.     DelayMS 100           ' 1s
    33.     PORTC=%00010010         'Digit 5
    34.     DelayMS 100            ' 1s
    35.     PORTC=%00000010         'Digit 6
    36.     DelayMS 100           ' 1s
    37.     PORTC=%11111000         'Digit 7
    38.     DelayMS 100            ' 1s
    39.     PORTC=%00000000         'Digit 8
    40.     DelayMS 100            ' 1s
    41.     PORTC=%00010000         'Digit 9
    42.     DelayMS 100            ' 1s
    43.    
    44.    
    45.     PORTD=%00010010         'Yellow LED(both poles) ON
    46.    
    47.    
    48.     PORTC=%01000000         'Digit 0            '7 segement Display**
    49.     DelayMS 100          ' 1s
    50.     PORTC=%11111001         'Digit 1
    51.     DelayMS 100            ' 1s
    52.     PORTC=%00100100         'Digit 2
    53.     DelayMS 100           ' 1s
    54.     PORTC=%00110000         'Digit 3
    55.     DelayMS 100            ' 1s
    56.     PORTC=%00011001         'Digit 4
    57.     DelayMS 100            ' 1s
    58.     PORTC=%00010010         'Digit 5
    59.    
    60.    
    61.     PORTD=%00001100         'Green LED(1st pole) ON,Red LED(2nd pole) ON
    62.    
    63.    
    64.     PORTC=%01000000         'Digit 0         '7 segement Display**
    65.     DelayMS 100            ' 1s
    66.     PORTC=%11111001         'Digit 1
    67.     DelayMS 100            ' 1s
    68.     PORTC=%00100100         'Digit 2
    69.     DelayMS 100            ' 1s
    70.     PORTC=%00110000         'Digit 3
    71.     DelayMS 100            ' 1s
    72.     PORTC=%00011001         'Digit 4
    73.     DelayMS 100            ' 1s
    74.     PORTC=%00010010         'Digit 5
    75.     DelayMS 100            ' 1s
    76.     PORTC=%00000010         'Digit 6
    77.     DelayMS 100            ' 1s
    78.     PORTC=%11111000         'Digit 7
    79.     DelayMS 100            ' 1s
    80.     PORTC=%00000000         'Digit 8
    81.     DelayMS 100            ' 1s
    82.     PORTC=%00010000         'Digit 9
    83.     DelayMS 100            ' 1s
    84.    
    85.     GoTo main
    86.  
     
    Last edited by a moderator: Dec 17, 2013
Loading...