problem in output voltages

Discussion in 'Embedded Systems and Microcontrollers' started by gracey, Feb 24, 2011.

  1. gracey

    Thread Starter New Member

    Feb 19, 2011
    14
    0
    hi,
    we are making project "IC tester" using PIC16F877a. we had successfully load the program to the PIC... the problem is there's no output. the supplied voltage is 5V. when we checked the voltage across the IC, only 3V was measured. is the measured voltage across the IC which is 3V is the possible cause or reason why we obtain negative result?
    (there's no output in the LED display)
    Are we going to use transistor to amplify the voltage?
     
  2. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Can you post the source code and the schematic?
     
  3. gracey

    Thread Starter New Member

    Feb 19, 2011
    14
    0
    heres the code.. using picbasic....
    the schematic is just for the simulator...
     
    • and.zip
      File size:
      21 KB
      Views:
      16
  4. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    After a quick glance at the circuit, you need to but a resistor on the LEDs. But I don't think that is the problem.

    What IC are you testing, the PIC 16F887A, or...
     
  5. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    gracey Are you sure that code complied? I tried it in MikroBasic and it has a bunch of mistakes your delays are wrong endif Is End IF


    See if this don't work better
    Code ( (Unknown Language)):
    1.  
    2.  
    3. program M_basicand
    4.  
    5. 'main:
    6. '   Main program
    7. 'test one
    8. dim good as bit
    9. dim indi as byte
    10.  
    11. trisa = 0
    12. trisb = 0
    13. trisc = %00001111
    14. trisd.0 = 0
    15. portd.0 = 0
    16. portb = %00000000
    17. indi = 0
    18.  
    19. PORTB.0 = 0
    20. PORTB.1= 0
    21.     If PORTC.0 = 0 Then
    22.          Delay_ms(1000) 'so we don't miss ant thing'
    23.  
    24.        PORTB.0= 0
    25.        PORTB.1 = 1
    26.             If PORTC.0 = 0  Then
    27.                 Delay_ms(1000) 'so we don't miss ant thing
    28.  
    29.                PORTB.0= 1
    30.                PORTB.1 = 0
    31.                    If PORTC.0 = 0 Then
    32.                     Delay_ms(1000) 'so we don't miss ant thing
    33.  
    34.                       PORTB.0 = 1
    35.                       PORTB.1 = 1
    36.                         If Portc.0 = 1 Then
    37.                            good = 1
    38.                            Delay_ms(1000)
    39.                         else
    40.                            good = 0
    41.                         end if
    42.                    else
    43.                         good = 0
    44.                    end if
    45.             else
    46.                 good = 0
    47.             end if
    48.      else
    49.         good = 0
    50.      end if
    51.  
    52.      If good = 1 Then
    53.        PORTc.4 = 1
    54.        indi = indi + 1
    55.      Else
    56.           good = 0 ' was bad
    57.           PORTc.4 = 0
    58.      end if
    59.  
    60. 'second gate
    61.  
    62. PORTB.2 = 0
    63. PORTB.3= 0
    64.     If PORTC.1 = 0 Then
    65.          Delay_ms(1000) 'so we don't miss ant thing'
    66.  
    67.        PORTB.2= 0
    68.        PORTB.3 = 1
    69.             If PORTC.1 = 0  Then
    70.                 Delay_ms(1000) 'so we don't miss ant thing
    71.  
    72.                PORTB.2= 1
    73.                PORTB.3 = 0
    74.                    If PORTC.1 = 0 Then
    75.                     Delay_ms(1000) 'so we don't miss ant thing
    76.  
    77.                       PORTB.2 = 1
    78.                       PORTB.3 = 1
    79.                         If Portc.1 = 1 Then
    80.                            good = 1
    81.                           Delay_ms(1000)
    82.                         else
    83.                            good = 0
    84.                         end if
    85.                    else
    86.                         good = 0
    87.                    end if
    88.             else
    89.                 good = 0
    90.             end if
    91.      else
    92.         good = 0
    93.      end if
    94.  
    95.      If good = 1 Then
    96.        PORTc.5 = 1
    97.        indi = indi + 1
    98.      Else
    99.           good = 0 ' was bad
    100.           PORTc.5 = 0
    101.      end if
    102.  
    103.  
    104. 'third gate
    105.  
    106. PORTB.4 = 0
    107. PORTB.5= 0
    108.     If PORTC.2 = 0 Then
    109.          Delay_ms(1000) 'so we don't miss ant thing'
    110.  
    111.        PORTB.4= 0
    112.        PORTB.5 = 1
    113.             If PORTC.2 = 0  Then
    114.                Delay_ms(1000) 'so we don't miss ant thing
    115.  
    116.                PORTB.4= 1
    117.                PORTB.5 = 0
    118.                    If PORTC.2 = 0 Then
    119.                     Delay_ms(1000) 'so we don't miss ant thing
    120.  
    121.                       PORTB.4 = 1
    122.                       PORTB.5 = 1
    123.                         If Portc.2 = 1 Then
    124.                            good = 1
    125.                            Delay_ms(1000)
    126.                         else
    127.                            good = 0
    128.                         end if
    129.                    else
    130.                         good = 0
    131.                    end if
    132.             else
    133.                 good = 0
    134.             end if
    135.      else
    136.         good = 0
    137.      end if
    138.  
    139.      If good = 1 Then
    140.        PORTc.6 = 1
    141.        indi = indi + 1
    142.      Else
    143.           good = 0 ' was bad
    144.           PORTc.6 = 0
    145.      end if
    146.  
    147.  
    148. 'fourth gate
    149.  
    150. PORTB.6 = 0
    151. PORTB.7= 0
    152.     If PORTC.3 = 0 Then
    153.         Delay_ms(1000)'so we don't miss ant thing'
    154.  
    155.        PORTB.6= 0
    156.        PORTB.7 = 1
    157.             If PORTC.3 = 0  Then
    158.                 Delay_ms(1000) 'so we don't miss ant thing
    159.  
    160.                PORTB.6 = 1
    161.                PORTB.7 = 0
    162.                    If PORTC.3 = 0 Then
    163.                     Delay_ms(1000) 'so we don't miss ant thing
    164.  
    165.                       PORTB.6 = 1
    166.                       PORTB.7 = 1
    167.                         If Portc.3 = 1 Then
    168.                            good = 1
    169.                            Delay_ms(1000)
    170.                         else
    171.                            good = 0
    172.                         end if
    173.                    else
    174.                         good = 0
    175.                    end if
    176.             else
    177.                 good = 0
    178.             end if
    179.      else
    180.         good = 0
    181.      end if
    182.  
    183.      If good = 1 Then
    184.        PORTc.7 = 1
    185.        indi = indi + 1
    186.      Else
    187.           good = 0 ' was bad
    188.           PORTc.7 = 0
    189.      end if
    190.  
    191.       If indi = 4 Then
    192.         portd.0 = 1
    193.      Else              ' not all gate is good
    194.         portd.0 = 0
    195.      end if
    196.  
    197.  end .
    198.  
     
    Last edited: Feb 24, 2011
Loading...