Initializing Osc, Wdt and Power up


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77

    Cool Initializing Osc, Wdt and Power up

    Hi All,

    I always use the line
    @ device hs_OSC, wdt_on, pwrt_on, protect_off
    or something similar at the beginning of my code to set up the oscillator speed watchdog timer etc.
    I usually use PM but now have to use MPASM and it gives me an error on this code.
    What is the correct syntax when using MPASM?

    Chris

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by crhomberg View Post
    Hi All,

    I always use the line
    @ device hs_OSC, wdt_on, pwrt_on, protect_off
    or something similar at the beginning of my code to set up the oscillator speed watchdog timer etc.
    I usually use PM but now have to use MPASM and it gives me an error on this code.
    What is the correct syntax when using MPASM?

    Chris
    http://www.picbasic.co.uk/forum/showthread.php?t=543

  3. #3
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy

    Thanks Skimask,

    I checked out the thread and had the same problems and tried to fix them the same way but to no avail.
    I am just going to keep changing to HS when I program for now as I have a bigger problem.
    When I use MPASM 5.03 instead of PM all my serout2 commands seem to send out zeros. Also I programmed a small loop sending out a string and compiled using PM and all worked well, when I did the same with MPASM it would not change even when I deleted lines they kept being there. I changed the setting of INHX in the assembler settings of Mcode Studio and it programmed but again sent blank strings.

    Do you have any ideas, I used MPASM in the past without any problems but not this version, is it maybe that the latest version is not compatable?

    Regards


    Chris

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


    Did you find this post helpful? Yes | No

    Default

    You never told us your PIC # and your __CONFIG line
    Steve

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

  5. #5
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy

    I am using a 16F877A and this is a small program I wrote to test the MPASM.
    I compiled it with PM and it flashed the LED and sent the data out to my PC fine.
    I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0.

    Are there settings for MPASM that I have missed?

    Regards

    Chris

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by crhomberg View Post
    I am using a 16F877A and this is a small program I wrote to test the MPASM. I compiled it with PM and it flashed the LED and sent the data out to my PC fine. I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0. Are there settings for MPASM that I have missed? Regards
    Chris
    It would sure help if we could see the program, the configuration lines, the command line used to invoke PBP (if any), any notable options set in any program related to compiling this program...etc...etc...and anything else you can think of that might help...

  7. #7
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by crhomberg View Post
    I am using a 16F877A and this is a small program I wrote to test the MPASM.
    I compiled it with PM and it flashed the LED and sent the data out to my PC fine.
    I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0.

    Are there settings for MPASM that I have missed?

    Regards

    Chris

    OOPS!

    Here is the code,

    '************************************************* ***************
    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    define osc 20
    Include "modedefs.bas"

    COUNTER VAR BYTE

    COUNTER=0

    START:

    IF COUNTER= 250 THEN
    TOGGLE PORTD.0 'LED TO INDICATE LOOPING
    COUNTER=0
    ELSE
    Serout2 PORTA.0,16390,["COUNTER = ",DEC COUNTER,10,13] 'GOES TO MCSTUDIO SERIAL PROGRAM
    'SERIAL SPEED 38400, INVERTED, 8-BITS, NO PARITY
    COUNTER=COUNTER+1
    ENDIF

    GOTO START

  8. #8
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking

    I found my problem, I had the settings for MPASM in MC studio set to case sensative. When I unchecked that all works fine.

    Thanks Guys

Similar Threads

  1. Pin won't stay high during Repeat...Until loop??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th August 2009, 23:57
  2. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  3. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  4. Minimum power modes for PIC18LF4620
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th February 2008, 01:30
  5. PIC10F206 - What is the LOWEST Power @ Rest or Sleep
    By rixtalbert in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 18th March 2007, 14:42

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