Why doesn't my code for 18f452 work on 18f252?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    As Mike already pointed out, you really do need to disable A/D on PORTA.0 with ADCON1 = 7. These pins are by default A/D inputs until you configure them for digital I/O with ADCON1. It may just be a fluke that it's working on the 452 with RA0 configured as an A/D input.

    This (below) isn't part of the problem, but if you want the expected results from both statements then change;

    LCD_LINES2

    to

    LCD_LINES 2 ' < -- need the separation

    And

    If LCD1 => 92 Then

    to

    If LCD1 >= 92 Then ' = should always be after > when combined.

    Also be sure to set HS VS XT or you may not be providing enough drive for the higher speed crystal.

    when you run it on the 252 chip the watchdog timer times out
    PBP should automatically handle resetting the WDT for you, but if you suspect the WDT is fouling things up, just disable it before programming the part.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Aug 2005
    Posts
    14


    Did you find this post helpful? Yes | No

    Default I Fixed IT

    Thanks for the replys guys. I tried everything that you suggested but it did not fix the problem. Out of desperation I was just trying different things and moved the the LCD Data Port from PortC to PortB and it works fine now. I don't know what the difference is because the PortC pins on the 252 and 452 chips are suppose to be the same. If anyone knows what the difference may be I would be interested to know. Anyway thanks again guys and have a Merry CHRISTmas.

    RJ

Similar Threads

  1. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 08:25
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  3. Error code [112]/[113]
    By Dj tempo in forum General
    Replies: 3
    Last Post: - 17th June 2007, 17:15
  4. Code: Why is this code greater than 2000 words?
    By DrDreas in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 1st June 2007, 20:51
  5. Replies: 1
    Last Post: - 31st August 2005, 21:00

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