can't even flash an LED


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Bruno333,

    B>>Certainly you can symbol a specific output right?<<

    Yes, you can. But I wanted to give you the simplist of code to start out with.

    LEDPin var GPIO.2

    Loop:
    High LEDPin
    pause 500
    Low LEDPin
    Pause 500
    goto Loop
    end


    Dwayne
    Last edited by Dwayne; - 27th April 2005 at 22:11.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    FYI TRIS statements are not necessary when you're using the PBP HIGH & LOW commands. PBP *automatically* sets the pin up as an output.

    If you use GPIO.2 = 1 or 0, then you'll need to first set the TRIS register to make this bit an output. If you use HIGH or LOW GPIO.2, then PBP sets GPIO.2 up as an output automatically.

    Why the PicKit board gives you odd results is due to the way the LED's are wired on the board. Look for the PicKit board schematic or download it here http://ww1.microchip.com/downloads/e...Doc/40051D.pdf

    Here's a simple BASIC example that strobes LED's D0 to D7 on the PicKit 1 board.
    Code:
    @ DEVICE PIC12F675, INTRC_OSC, WDT_OFF, MCLR_OFF
    Define	OSCCAL_1K	1	' Calibrate internal oscillator
    
    CMCON = 7 ' Comparators OFF 
    ANSEL = 0 ' A/D OFF 
    
    ' Modified from Microchip PicKit 1 state.asm demo source
    D0_D1	CON %00001111	; TRISIO setting for D0 and D1
    D2_D3	CON %00101011	; TRISIO setting for D2 and D3
    D4_D5	CON %00011011	; TRISIO setting for D4 and D5
    D6_D7	CON %00111001	; TRISIO setting for D6 and D7
    
    '; define LED state (what GPIO will equal)
    D0_ON	CON %00010000		; D0 LED
    D1_ON	CON %00100000		; D1 LED
    D2_ON	CON %00010000		; D2 LED
    D3_ON	CON %00000100		; D3 LED
    D4_ON	CON %00100000		; D4 LED
    D5_ON	CON %00000100		; D5 LED
    D6_ON	CON %00000100		; D6 LED
    D7_ON	CON %00000010	 	; D7 LED
    
    TIME VAR BYTE
    
    Main:
        FOR TIME = 50 TO 200 STEP 25
    
            TRISIO = D0_D1 : GPIO = D0_ON
            PAUSE TIME : GPIO = D1_ON
            PAUSE TIME
    
            TRISIO = D2_D3 : GPIO = D2_ON
            PAUSE TIME : GPIO = D3_ON
            PAUSE TIME
    
            TRISIO = D4_D5 : GPIO = D4_ON
            PAUSE TIME : GPIO = D5_ON
            PAUSE TIME
    
            TRISIO = D6_D7 : GPIO = D6_ON
            PAUSE TIME : GPIO = D7_ON
            PAUSE TIME
    
        NEXT TIME
        GOTO Main
    Last edited by Bruce; - 28th April 2005 at 05:26.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    bruno333's Avatar
    bruno333 Guest


    Did you find this post helpful? Yes | No

    Default

    Yeah, I just figured out the LED wiring of the Pickit a few minutes ago before I read your post. Very strange way to do things? I've used several development boards, and usually LED's are wired individually to the separate pins so you can quickly (and simply) check program operation. Why on earth did they do it this way? The LED's are wired with several forward and other's reverse polarity. Sure I guess you might want to experiment with Hi and low outputs... but geeze what a mess.

    Besides that, it's a nice programmer. No wall-wart, and 36 bucks.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    hehe that's what i often call an engineer trip. Bah that's doing food for your brain cells.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I think the idea was to show creative appplication of limited resource devices like the 8 & 14-pin targets. It is a nifty board considering the investment.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  2. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  3. I can't even make an LED flash!
    By George in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 3rd April 2007, 06:39
  4. Need help with write function
    By Christopher4187 in forum General
    Replies: 10
    Last Post: - 12th July 2006, 04:12
  5. elapsed time between two led flash...
    By dario in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th February 2006, 16:09

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