Driving me NUTS!


Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216

    Default Driving me NUTS!

    Hi once again all.
    I have a medium length program, with everything working....except for a couple of lines .....

    What I have is a BINARY coded switch feeding 4 bits into portD lower 4 bits. The inputs have pull-down resistors and the switch switches 5v into the inputs.

    The code is like this...


    BLAH
    BLAH
    BLAH chip setup and first part working fine.
    included in the above:
    TRISD = %00001111 'low 4 bits inputs, high 4 bits unused

    LOOP:
    PORTB = PORTD
    goto loop

    after I read the inputs, go on to more code, which works OK
    BLAH
    BLAH
    BLAH



    Now, there are LEDs on PORTB to repeat the settings on the input port.
    To my way of thinking, the inputs will be repeated on the LEDs and going to the loop will continually update the LEDs to match the inputs. IE, changing the switch position should be immediately repeated on the LEDs. (I have checked the PORTD input lines and they do change with the switch changes)
    BUT.....the only way I can get the LEDs to update is to reset the PIC and then the current switch setting comes up on the LEDs correctly. I am using a 16F877 and have in fact swapped chips 3 times with the same results each time.

    I have also added TOGGLE PORTC.0 , as a debug indicator, to just before the GOTO LOOP line and this output does in fact toggle, showing that the loop is looping correctly.

    The 3 line of code were originally to read the input switch settings, calculate a delay and a few other things. The 3 lines shown above are a result of simplifying the final code back to absolute basics because the original code wasn't working either and was taken simpler to try and see what the trouble was, but that didn't show anything. It seems to me that the 3 lines above can't get much simpler and should work OK.
    Last edited by muddy0409; - 13th October 2005 at 06:23.

Similar Threads

  1. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 00:15
  2. Replies: 1
    Last Post: - 1st May 2008, 05:07
  3. Buttons are driving me nuts
    By Doormatt in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st May 2007, 23:09
  4. driving APR6008
    By mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th December 2006, 18:37
  5. Driving a logic-level HEXFET
    By thelightbrain in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th November 2004, 23:34

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