What am I doing wrong?


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default What am I doing wrong?

    I have the simplest piece of code that I have probably ever written, but it still doesn't work. The code is as follows, and is supposed to flash a LED connected to PortF.1 The LED refuses to flash.

    Chip is 18F66J60
    Crystal is 25MHz (yes, I know my flash rate will be off)
    Watchdog timer is OFF
    Oscillator is set to OSC1,OSC2 inputs and "HS mode"
    An oscilloscope confirms that the crystal is oscillating with
    a good 25MHz signal.

    Can someone tell me what I'm doing wrong?


    DEFINE OSC 20

    TRISF = %00000000 ' Make all output
    ADCON1 = %11111111 ' Make certain that PortF.1 is digital
    CMCON = %00000000 ' Disable comparator outputs


    Flash:

    PortF.1 = 1
    PAUSE 1000
    PortF.1 = 0
    PAUSE 1000
    GOTO Flash


    END
    Charles Linquist

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    ADCON1 = 15
    CMCON  = 7
      ??
    <br>
    DT

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Problem solved!

    In our lab, we had an old version of MPLAB (7.20) that apparently didn't support the 18F67J60 properly. I upgraded to MPLAB version 8.0 - VOILA! The LED is flashing now.
    Charles Linquist

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I should also mention that I use an ICD2 to load code. MPLAB version 7.2 was setting the configuration registers incorrectly.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    first post it was a 66J60, and now 67J60

    it still work even with CMCON=0 ? but yeah.. maybe as long as there's nothing attach to the comparator input... it shouldn't caused any grief.. i'm just a little bit surprised

    EDIT: thanks for the update about ICD2
    Steve

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

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Can't imagine Charles using less than 128K.
    So I believe it was a 67J60 all along.
    <br>
    DT

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    A typo. I'm using an 18F67J60

    And Darrel, you are correct. I'm constantly hammering on Microchip to build a bigger 18F part.
    It seems that I might be getting their attention. Stay tuned!
    Charles Linquist

Similar Threads

  1. LCD Showes Some Wrong Letters
    By sbobowski in forum General
    Replies: 2
    Last Post: - 23rd September 2008, 19:15
  2. Anyone know whats wrong with this code
    By Bonxy in forum Serial
    Replies: 10
    Last Post: - 9th March 2007, 16:29
  3. ADCIN - AD settings are wrong
    By teverett in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th December 2006, 16:32
  4. What am I doing wrong?
    By mankan in forum General
    Replies: 1
    Last Post: - 23rd June 2006, 19:03
  5. HDD IDE ATA 2 interface problems. code wrong?
    By rastan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th March 2005, 16:01

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