PIC18f2455 blink


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Question Blinking LED not working !

    I try this code for blinking led on PIC18f452 , but nothing happened, the led always off , I use in this circuit 4MHZ XT crystal , 10K connected to MCLR TO +5v:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    trisb=0

    main:
    portb=0
    pause 1000

    portb=255
    pause 1000

    goto main

    end

    ;;;;;;;;;;;;;;;;;;;;;;;;;

    Here is 18F452.INC file
    ;************************************************* ***************
    ;* 18F452.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2005 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 12/16/05 *
    ;* Version : 2.47 *
    ;* Notes : *
    ;************************************************* ***************
    NOLIST
    ifdef PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    NOLIST
    else
    LIST
    LIST p = 18F452, r = dec, w = -311, w = -230, f = inhx32
    INCLUDE "P18F452.INC" ; MPASM Header
    __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    __CONFIG _CONFIG4L, _LVP_OFF_4L
    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 8

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    I try this code for blinking led on PIC18f452 , but nothing happened, the led always off , I use in this circuit 4MHZ XT crystal , 10K connected to MCLR TO +5v:
    Connect the LED to MCLR...does it work then?
    And let it run for at least 2 minutes.
    Does the LED on PortB.0 change state?

  3. #3


    Did you find this post helpful? Yes | No

    Default

    when I connect Led to MCLR it work but with very low brightness, nothing happened to portb.0
    Last edited by iugmoh; - 4th March 2008 at 23:02.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    yes it work but with very low brightness
    What works?
    MCLR or PortB.0?
    Does it flash?
    What's the value of your resistor?

  5. #5


    Did you find this post helpful? Yes | No

    Default

    oky , I connect MCLR -------> led through 470 ohm resistor , the brightness is very low, nothing happened to portb always off

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    oky , I connect MCLR -------> led through 470 ohm resistor , the brightness is very low, nothing happened to portb always off
    The point of the LED on MCLR was to make sure that MCLR was actually getting pulled up to +5v.

Similar Threads

  1. Trouble with most basic BLINK on PIC 16F819
    By confusedperson in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 16th April 2009, 22:46
  2. Simple Blink program doesnt work.
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st March 2009, 21:30
  3. Can't get blink circuit to work :(
    By Techbuilder in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 31st January 2008, 14:00
  4. I Just Can't Get it to Blink - 16F628
    By Spindle in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st May 2005, 16:54
  5. 20Mhz crystal cause led to blink irreguarly
    By niknaksbarbeque in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th April 2005, 12:35

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