Very strange problem...


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Jun 2005
    Posts
    20

    Default Very strange problem...

    Hi--

    I've got PBP2.6 with a U2 programmer here, and I have been happily writing and debugging PICBASIC programs since 1996, so I'm not a newbie. However, I'm having a problem here that I just can't find the source of... PIC is an 18F4520 assembling with MPASM, and here's the deal:

    This code (and this is the ENTIRE program) works:

    Code:
    DEFINE OSC 8
    
    OSCTUNE = %11000000     'int low speed clock from osc 
    OSCCON =  %01110000     '8mhz internal oscillator 
    
    start:
        low portd.5 'LED on
        pause 100
        high portd.5 'LED off
        pause 100
    goto start
    
    lcdout $fe, 1
    As expected, this program flashes the LED on portd.5. I should point out that there is no LCD attached to the board, I removed it during my debugging process, along with all the other code.

    Here's the really weird part, the code below DOES NOT work:

    Code:
    DEFINE OSC 8
    
    OSCTUNE = %11000000     'int low speed clock from osc 
    OSCCON =  %01110000     '8mhz internal oscillator 
    
    start:
        low portd.5 'LED on
        pause 100
        high portd.5 'LED off
        pause 100
    goto start
    The only difference is I eliminated the LCDOUT command, which isn't inside the loop of the code that executes in the above (working) example anyway, so why does the code that contains the command work, whereas the lower code without it does not?

    Configuration in MeProg is set to INTRC, PWRT ON, brownout reset off, WDT enabled, MCLR set to RESET (and yes, there is a pullup on MCLR pin).

    Any ideas where to look??

    Thanks--

    --Alan
    Last edited by alanmcf; - 7th May 2011 at 00:55. Reason: typo more typos

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