Leds on/off


Closed Thread
Results 1 to 17 of 17

Thread: Leds on/off

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hello mackrackit,

    I have added TRISB =% 00001111 but as usual the code does not work well.

    Thanks
    Leonardo


    Quote Originally Posted by mackrackit View Post
    You will need to set the TRIS for the port. That will tell what pins are input or out puts.
    Try adding this near the top of your code.
    Code:
    TRISB = %00001111
    That will make PORTB 0 to 3 an input and 4 to 7 an output.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you post the whole code and exactly what is it doing or not doing?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Code:
    iF PORTB.1=0 then
        HIGH PORTB.5
        WHILE PORTB.0=0 : Wend : pause 50
        ENDIF
    Why not use Toggle ?
    Code:
    IF PORTB.1=0 then
        toggle PORTB.5
        WHILE PORTB.0=0 : Wend : pause 50
        ENDIF
    Do not know what you are doing with PORTB.0 or why it is always low in each
    if then loop . . . or is that a copy paste error, and is low only in the first loop ?
    maybe should be PortB.1 in this loop ? Select case could tidy this up even more . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    If you are simulating it as seen in your schematic, then the simulator might be giving false simulation because you do not have resistors on the leds.

    I say this is 98% possibility of the error you are getting.

    ------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Talking the car without engine ...

    Hi,

    I do not remember the 16F84 had an internal oscillator ...

    none aboard the ( censored ) simulation ...

    But I'm just getting 53 ...

    Alain

    PS: Ahhhhh ... Da Vinci Code !!!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    I do not remember the 16F84 had an internal oscillator ...

    none aboard the ( censored ) simulation ...

    But I'm just getting 53 ...

    Alain

    PS: Ahhhhh ... Da Vinci Code !!!!
    16F84 and 16F84A do not have internal OSC...

  7. #7
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by phoenix_1 View Post
    16F84 and 16F84A do not have internal OSC...
    Quote Originally Posted by Acetronics View Post
    Hi,

    I do not remember the 16F84 had an internal oscillator ...

    none aboard the ( censored ) simulation ...

    But I'm just getting 53 ...

    Alain

    PS: Ahhhhh ... Da Vinci Code !!!!

    On his simulator, it is not required to connect crystal or resonator etc.
    It will run normally as if those were connected.

    ---------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Run a string of LEDs from the mains
    By The Master in forum Off Topic
    Replies: 30
    Last Post: - 1st October 2009, 18:55
  2. Replies: 14
    Last Post: - 26th April 2007, 15:12
  3. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  4. controlling leds with the switches
    By ilteris in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th October 2005, 21:02
  5. Replies: 5
    Last Post: - 16th February 2005, 11:57

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts