Announcement

Collapse
No announcement yet.

18F4620 Clock and timing issues.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 18F4620 Clock and timing issues.

    Hi,
    I recently reloaded the OS and reinstalled Microcode studio, PBP 2.5 , and MPlabs. (and after I noticed the current issue, updated Microcode Studio to 4.0 and MPlab to 8.15)
    I have known working code for the 18f4620, but now if I compile the code the HEX file has one line that is different. Something to do with the clock I think, it is causing timing issues and runs noticeably slower.

    Here is the last four lines from the new and old hex files with the offending line:

    Bad hex
    ==================
    :02122000FED7F7
    :020000040030CA
    :08000000FFF1FFF3FFFDBBFF60
    :00000001FF
    ==================

    good hex
    ==================
    :02122000FED7F7
    :020000040030CA
    :08000000FFF8FFF3FFFDBBFF59
    :00000001FF
    ==================


    My code:

    '****************************************************************
    '--- DEBUG SETTINGS -------
    DEFINE DEBUG_REG PORTE
    DEFINE DEBUG_BIT 0
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 1
    DEFINE DEBUG_PACING 30000

    '--- LCD SETTINGS ----------
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 5
    DEFINE LCD_LINES 2

    '--- OSC SETUP ------------
    DEFINE OSC 32
    OSCCON = %01110000 ' SET INT. OSC TO 8MHZ
    OSCTUNE = %01000000 ' 4 X FREQ. MULTIPLIER ON
    '---------------------------

    ADCON0 = 0 ' ADC BIT 5-2(XXXX=CHANNEL) BIT0(1=ON 0=OFF)
    ADCON1 = 15 ' BIT 3-0(A/D PORT CONFIG) 15= ALL DIGITAL
    CMCON = 7 ' COMP OFF

    TRISA = %00000000
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00000000
    '----------------------------



    '===============================================================

    The ASM files both look like they are setting OSC the same.







  • #2
    looks to me like you altered the inc file for your chip in the old installation , now with the new install those edits have been lost.
    you need to review the default config settings in the inc file and amend to suit or preferably add a config section to your source code

    Comment


    • #3
      I got an old machine going that had backup files. The INC files were altered. Time to learn how to do things properly!

      Comment

      Working...
      X