Driving me NUTS!


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Muddy. I am not at all familiar with the PIC you are using except I read a post by someone who had PORTD problems and fixed them with setting the ADCON1 and ADCON2 registers.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default

    Hi Muddy,
    First make a short loop blinking the LED's on PORTB to make sure they work and that the port is set up correct. (Which they seem to be since it reflects changes on reset).

    Code:
    For i = 1 to 5
      PortB = %00001111
      Pause 200
      PortB = %00000000
    Next
    Then try to read PortD to a variable first and then write that variable to PortD.

    Code:
    Switch VAR Byte
    Loop:
      Switch = PortD                 'Read PortD, store in Switch
      PortB = Switch                 'Write switch to PortB
      Pause 10                         'Wait 10mS
    Goto Loop                          'Do it again.
    How about that, does that work?

    /Henrik Olsson. (At work, no board to test with here.)

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


    Did you find this post helpful? Yes | No

    Default

    Gooday Henrik.
    Tried that along the way back from final code back to the simplified code described above. No, it doesn't work.

    Peter

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


    Did you find this post helpful? Yes | No

    Default I found it!!

    Thanks to everyone who made suggestions. But I RTFM and came up with the answer, which just may help someone else.....
    PORTD is also the PARALLEL SLAVE PORT. To make it a general purpose I/O port, Bit4 of TRISE must be set to 0 IE TRISE.4 = 0

    Did that and now seems to be OK. Will spend the next few hours reverting to the final code and see what happens.


    Peter Moritz.

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