Blinky not working with TOGGLE


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Location
    Brussels, Belgium
    Posts
    104

    Default Blinky not working with TOGGLE

    Now I'm stumped. My usual simple BLINKY is:

    [code]
    LED VAR PORTB.0
    Loop:
    Pause 1000
    toggle LED
    Goto Loop
    [\code]

    Usually works fine but seemingly not on a 16F777. the LED just stays on. This does work:

    [code]
    LED VAR PORTB.0
    LOOP:
    LED = 1
    pause 1000
    LED = 0
    pause 1000
    goto LOOP
    [\code]

    So what no doubt blindingly obvious simple thing am I overlooking ?

    Andrew

  2. #2
    Join Date
    Jul 2008
    Location
    TURKIYE-KONYA
    Posts
    51


    Did you find this post helpful? Yes | No

    Default simply "xor"

    Quote Originally Posted by AndrewC View Post
    Now I'm stumped. My usual simple BLINKY is:

    [code]
    LED VAR PORTB.0
    Loop:
    Pause 1000
    toggle LED
    Goto Loop
    [\code]

    Usually works fine but seemingly not on a 16F777. the LED just stays on. This does work:

    [code]
    LED VAR PORTB.0
    LOOP:
    LED = 1
    pause 1000
    LED = 0
    pause 1000
    goto LOOP
    [\code]

    So what no doubt blindingly obvious simple thing am I overlooking ?

    Andrew
    i usually work with " xor " instead of toggle command.

    for example ;
    main :

    led = led xor 1 ; working better than toggle
    pause 100

    goto main

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


    Did you find this post helpful? Yes | No

    Default

    it's not going to work with XOR... ^1 would work.

    AndrewC, post your Whole code, sure enough you have something else on the top of it. As usual check for multiplexed stuff on the offending I/O.
    Steve

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

  4. #4
    Join Date
    Feb 2006
    Location
    Brussels, Belgium
    Posts
    104


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies - turns out it was a naff PIC. After some more tinkering last night I started getting programming errors. Tried an 877A to check my programmer, no problems. Pulled a new 777 and voila, success. Phew - just goes to prove - don't assume anything !

Similar Threads

  1. Toggle command
    By mr.sneezy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 16th December 2011, 02:07
  2. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  3. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  4. TOGGLE code space and ICD
    By duncan303 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th October 2006, 16:08
  5. Hserin not working...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd August 2005, 12:25

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