Newbie: Trying to blink a LED


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2006
    Posts
    21

    Default Newbie: Trying to blink a LED

    Can someone help me get started. I have been trying to blink a LED using a 16F88 all morning without any success. What is wrong with my code?
    Also is there ea way to define in code the chip being used so I dont have to select it each time from the drop-down? Thanks

    @ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, WDT_OFF

    LOW PORTB.1

    LOOP:
    Toggle PORTB.1
    Pause 1000
    GoTo LOOP

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    JackPollack;

    If you are working with PBP and the 16F88, I believe you need to put

    OSCCON = $60

    in your code to get the internal clock to run at 4MHz instead of 32kHz. If you do not put this in your code or if you do not tell PBP that you are running at 32kHz instead of the default 4MHz, then a Pause 1000 really equals =

    1 second * 4,000,000/32,000 = 125 seconds!

    Since you start with the portb.1 low, did you wait over two minutes to see if your light came on? Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  3. #3
    Join Date
    Feb 2006
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Thanks for your reply.

    I tried your suggestions, but no dice.

    I am not seeing any logic levels on any of the outputs (they are all tri-stated). I have tried a different chip and the second one does the same.

    Any other ideas?

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    JackPollack,

    The following worked great on my 16F88:

    ;@ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, WDT_OFF
    OSCCON = $60
    LOW PORTB.1
    LOOP:
    Toggle PORTB.1
    Pause 1000
    GoTo LOOP

    Notice that I commented out your fuse settings. I suggest picking them in the EPIC menu until you can get it running. My best guess is that INTRC_OSC_NOCLOCKOUT is not a correct setting but I could not verify. (I use MPASM exclusively and had the fuses set as shown in the attached.) As a check, I had pin 5 tied direct to ground, pin 14 tied direct to 5V, and had an LED between pin 7 and ground. Again, Good Luck

    Oh, also see: http://www.picbasic.co.uk/forum/show...ighlight=16f88

    Paul Borgmeier
    Salt Lake City, Utah
    USA
    Attached Images Attached Images

  5. #5
    Join Date
    Feb 2006
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Problem solved

    Thanks to all that posted. I found the problem was a bad PIC programmer.
    Everything is working great now.

    Thanks again.

  6. #6


    Did you find this post helpful? Yes | No

    Default intrc

    Quote Originally Posted by paul borgmeier View Post
    JackPollack,

    The following worked great on my 16F88:

    ;@ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, WDT_OFF
    OSCCON = $60
    LOW PORTB.1
    LOOP:
    Toggle PORTB.1
    Pause 1000
    GoTo LOOP

    Notice that I commented out your fuse settings. I suggest picking them in the EPIC menu until you can get it running. My best guess is that INTRC_OSC_NOCLOCKOUT is not a correct setting but I could not verify. (I use MPASM exclusively and had the fuses set as shown in the attached.) As a check, I had pin 5 tied direct to ground, pin 14 tied direct to 5V, and had an LED between pin 7 and ground. Again, Good Luck

    Oh, also see: http://www.picbasic.co.uk/forum/show...ighlight=16f88

    Paul Borgmeier
    Salt Lake City, Utah
    USA
    paul
    i agree intrc_osc_noclockout
    does not seem corect pic manual state it has 3 noclock setting
    and three osc speed 4 - 8 and adj
    cant seem to find the corect syntax though

  7. #7
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    it turns out "INTRC_OSC_NOCLKOUT" is correct (see m16f88.inc in your pbp folder). The code I posted in this thread worked for me - 1 second delays were one second. I did not use the @ device line (hence, it is commented out) but picked them from the menu in MPLAB (I do not use PM).

    I am not sure what problems you are having or what you are asking here?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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. Newbie question about switch + led
    By mradde in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 24th January 2009, 17:40
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. Novice 16F83A BLINK LED program help
    By owali in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 25th July 2007, 05:02
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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