Announcement

Collapse
No announcement yet.

Can't seem to get a port to go high

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't seem to get a port to go high

    I'm having an issue with a clock that I'm making. I have the functionality all working except for one thing: controlling a port so I can make it go high and low to turn on an LED or buzzer for the alarm. As far as I know, all I should have to do is to have a line like: portb.7 = 1 and portb.7 = 0, but those aren't giving me any control over my two free ports (portb.7 and portb.0). I've tried loading a new program that only turns ports high/low, and that program works just fine.

    Also, for some reason the voltage on these two pins slowly increases as time goes on; it went as high as 7.5V despite there being only 5V in the circuit. However, this only happens when my Pickit2 isn't plugged in; when it is plugged in, the voltage drops to less than 1V and stays there.

    I'm using a 16F88 as my chip.

    Is there something small that I'm missing here?
    Attached Files

  • #2
    by default portb.7 will be configured as an input . the revelent section from the pbp3 manual
    5.48 OUTPUT
    OUTPUT Pin
    Make the specified Pin an output. Pin may be a constant, 0 - 15, or a variable that
    contains a number 0 - 15 (e.g. B0) or a pin name (e.g. PORTA.0).
    OUTPUT 0 ' Make Pin0 an output
    OUTPUT PORTA.0 ' Make PORTA, pin 0 an output
    Alternatively, the pin may be set to an output in a much quicker and shorter way
    (from a generated code standpoint):
    TRISB.0 = 0 ' Set PORTB, pin 0 to an output
    All of the pins on a port may be set to outputs by setting the entire TRIS register at
    once:
    TRISB = %00000000 ' Set all of PORTB to outputs
    nb. the pickit uses pins portb6:7 and has a pull up on portb.7 and drives portb.6 high . this may interfere with you pgm , best to disconnect it after programing chip in this case

    Comment


    • #3
      Originally posted by richard View Post
      by default portb.7 will be configured as an input . the revelent section from the pbp3 manual


      nb. the pickit uses pins portb6:7 and has a pull up on portb.7 and drives portb.6 high . this may interfere with you pgm , best to disconnect it after programing chip in this case
      And that did it, thanks. I done any programming in months, so I'm not surprised that I forgot something simple like that.

      Thanks for the help.

      Comment

      Working...
      X