Blinking LED will not Blink


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237

    Angry Blinking LED will not Blink

    Hi thank you for reading this:-

    I am attempting to do simple litle program using a 627 / 628 that just loops a sequence of morse Led port on and off ... to Say "Don't Panic"

    ll works ok as it should but for one flash of LED 2nd or 3rd charactor (dots) in the D'

    See attached code.... I have attempted to re write the code... Use another chip... I have used another compiler but the thing will not flash that one last dot for me... I just get Dash, dot... D is Dash,dot,dot !!!!

    What am I doing wrong.... Have marked up the line :--

    XXXX dot !!!

    I have stuggled with this all afternoon....... Help !!!

    BR
    Andy
    Attached Files Attached Files

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    I think you need to change your tris settings. Unless I missed something?

    You Have
    Code:
           TRISA=0          'All A Port outs
           TRISB=15         'All B Port Ins
           CMCON=7
            
           LED VAR PORTB.0
    TRISB = 15 = %00001111 which means you have portb 0 - 3 as inputs

    Try Trisb.0 = 0 or trisb = 0

  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    Quote Originally Posted by andybarrett1 View Post
    Hi thank you for reading this:-

    I am attempting to do simple litle program using a 627 / 628 that just loops a sequence of morse Led port on and off ... to Say "Don't Panic"

    ll works ok as it should but for one flash of LED 2nd or 3rd charactor (dots) in the D'

    See attached code.... I have attempted to re write the code... Use another chip... I have used another compiler but the thing will not flash that one last dot for me... I just get Dash, dot... D is Dash,dot,dot !!!!

    What am I doing wrong.... Have marked up the line :--

    XXXX dot !!!

    I have stuggled with this all afternoon....... Help !!!

    BR
    Andy
    There is nothing wrong with your code.

    Except
    Code:
    morse:pause 3500
          High led
          pause 5000       'Led on for 5 seconds
    
    D:    high led          'dash
          pause 1500      low led
          pause 500
          high LED         'XXXX  dot !!!
          pause 500
          low led
          pause 500
          high LED         'XXXX  dot !!!
          pause 500
          low led
          pause 1500       'gap
    The LED is high for five seconds then stays high for another 1.5 seconds on the "D dash" therefore you will not see any change and this could be the flash you are missing. To check add another "low led pause 500" after the "pause 5000".

    Code:
    morse:pause 3500
          High led
          pause 5000       'Led on for 5 seconds
          low led
          pause 500
    
    D:    high led          'dash
          pause 1500
          low led
          pause 500
          high LED         'XXXX  dot !!!
          pause 500
          low led
          pause 500
          high LED         'XXXX  dot !!!
          pause 500
          low led
          pause 1500       'gap

  4. #4
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Red face Re: Blinking LED will not Blink

    Hi Steve...

    It was the missing pause.. I worked it out just now...All working now :-)

    Totally didn't see that for 4 hours yesterday.....


    Thank you both Mark and Steve

    Have also righted the port setup too

    BR
    Andy

  5. #5
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    I can make some suggestions for improvements if you want. Like use GOSUB. Bye the way as you use HIGH and LOW the tris is set automatically and you do not need to set it in your code. If you used LED=1 and LED=0 then you have to set tris in your code.

  6. #6
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    Hi

    Always open to suggestion…. I did think of using Gosubs…But then reasoned as my code only 0k5 not worth it..

    Seems to be TRIS's seem to depend on how the sea state is in Liverpool as to when to set or not set. :-)

    Thank you again…..

    All help / suggestions welcome

  7. #7
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    The only reason is to learn as one never knows when or indeed if what one learns will be useful.

    Create two subroutines one for dot and one for dash. Then in main D will be

    Gosub Dash
    Gosub Dot
    Gosub Dot

    Just as a start.

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,620


    Did you find this post helpful? Yes | No

    Default Re: Blinking LED will not Blink

    Hi,

    May be it is a bit overkill here ....

    but, When Melanie deals with something ....

    WOOOOHOOOO !!! ...

    that's great !!!

    http://www.picbasic.co.uk/forum/showthread.php?t=5510

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Simple Blinking LED - WTF!!
    By johnnylynx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st February 2010, 07:19
  2. PIC16F819 LED not blinking
    By ronbowalker in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 1st December 2009, 03:04
  3. blinking LED
    By kindows in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 31st July 2009, 17:08
  4. PIC18f452 blinking led ?
    By iugmoh in forum General
    Replies: 5
    Last Post: - 7th March 2008, 15:12
  5. Why is my LED not blinking?
    By Gary Goddard in forum General
    Replies: 14
    Last Post: - 1st January 2007, 21:23

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts