Portb = % ???


Closed Thread
Results 1 to 3 of 3

Thread: Portb = % ???

  1. #1
    Join Date
    Jul 2007
    Posts
    48

    Default Portb = % ???

    Shouldnt this code make all leds on PORTB blink?
    Now its only one led thats blink (PORTB.1)

    Code:
    @   device  pic16F648A, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
    DEFINE OSC 20
    
    
    loop:
    
            high PORTB = %11111111
            pause 250
            low PORTB = %11111111
            pause 250
            goto loop
            end

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    TRISB = 0       'Assign all pins as output pins.
    
    loop:
    
            PORTB = 255     'Set all PortB pins HIGH. Or, PORTB = %11111111.
            PAUSE 250
            PORTB = 0       'Set all PortB pins LOW.  Or, PORTB = %00000000.
            PAUSE 250
            GOTO loop
            
            
    '        "HIGH" Command can be used for an individual pin.
    '            Ex: HIGH PORTB.0    'This will set PORTB.0 high.
    '                LOW  PORTB.0    'This will set PORTB.0 Low.
    
    end
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Sigh....

    Only the third time THIS MONTH...

    If you read the manual, or downloaded the manual (it's FREE!!!) if you don't have one, or SEARCHED the forum, you will have discovered that HIGH and LOW only work on a PIN and NOT on a PORT which is why you're only blinking ONE pin.

    ooops... just noticed that's what sayzer just said... ah well, nothing like reenforcing the message....

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Thermo 7 segments - little problem
    By fratello in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 27th July 2013, 07:31
  3. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  4. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  5. Working with indivividual bytes of an array
    By J_norrie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd January 2007, 19:16

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