help with code needed


Closed Thread
Results 1 to 2 of 2
  1. #1
    ccronin4's Avatar
    ccronin4 Guest

    Default help with code needed

    I'm trying to learn pic basic programming from the book by dogan ibrahim
    "pic basic programming and projects." even though it is compiling the led's should light up seqentiallt but mine as per simulatator hangs on the first 2 outputs?
    code from book
    symbol trisb =134
    symbol portb= 6
    symbol led =b0
    symbol ms500 = 500
    poke trisb,0
    led = 0
    again:
    poke portb,led
    pause ms500
    led =led+1
    goto again
    end

    my code??

    TRISB = 134
    PORTB = 6
    led VAR PORTA.0
    symbol ms500 =500
    poke TRISB,0
    led =0
    again:
    poke PORTB,led
    pause ms500
    led = led+1
    goto again
    end


    can any point out the mistake in syntax or logic???
    chris

  2. #2
    Join Date
    Aug 2005
    Location
    Vermont
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Try:

    led var byte

    instead of:

    led var porta.0

    You are defining 'led' to a port pin and then trying to poke it into another port pin.

    That should make it work as expected.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Code space needed with MPASM??
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th September 2007, 10:24

Members who have read this thread : 1

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