Compiling problem


+ Reply to Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    May 2025
    Posts
    2

    Default Compiling problem

    Hello, I have this code, but I can't compile it. I always get error. Could someone please compile it and post the hex file here? Thanks
    sorry for my english.


    @ DEVICE pic12F629, INTRC_OSC_NOCLKOUT ; Using Internal Clock, no clock out

    @ DEVICE pic12F629, WDT_ON ; Enable Watch dog timer
    @ DEVICE pic12F629, PWRT_ON ; Enable Power-up timer
    @ DEVICE pic12F629, MCLR_OFF ; Disable MCLR pin
    @ DEVICE pic12F629, BOD_ON ; Enable Brown-out detect
    @ DEVICE pic12F629, CPD_OFF ; EEPROM Protect
    @ DEVICE pic12F629, PROTECT_OFF ; Code Protect off

    TRISIO = %11111110
    INTCON.6=0 ' Disable all unmasked Interrupts
    INTCON.7=0 ' Disable Global Interrupts
    CMCON = 7 ' Disable analog comparator

    ServoOut var GPIO.0
    SetLimitSw var GPIO.1
    PotIn var GPIO.2
    MinSw var GPIO.4
    MaxSw var GPIO.5

    wPosit var word
    Posit var byte
    MinPosit var byte
    MaxPosit var byte

    'load starting min and max positions
    data @ 0, 100
    data @ 1, 250

    '************************************************* ***************
    low Servoout

    'read in stored min and max limits
    read 0, MinPosit
    read 1, MaxPosit

    'for power-on reset of positions:
    if minsw = 1 then
    minposit = 100
    write 0, minposit
    endif
    if maxsw = 1 then
    maxposit = 250
    write 1, maxposit
    endif
    pause 1000

    Start:
    gosub GetServoPosition
    pulsout servoout, posit
    pause 20

    if setlimitsw = 1 then 'check min max buttons
    if minsw = 1 then
    MinPosit = Posit
    write 0, MinPosit
    pause 250
    endif

    if maxsw = 1 then
    MaxPosit = Posit
    write 1, MaxPosit
    pause 250
    endif
    endif

    goto start

    '************************************************* ***************
    GetServoPosition:
    high potin
    pause 1
    rctime potin, 1, wPosit 'at 4 mhz, returns 0 - 120

    'adjust posit to get values between 75 and 250
    'use word-sized variable because calculation might exceed 255
    wposit = wposit + 75 + (wposit / 2)

    'now limit posit to 100 - 250 (1 ms - 2.5 ms)
    'and put into byte-sized variable
    if wposit > 250 then
    posit = 250
    else
    posit = wposit
    endif

    if posit < 100 then posit = 100

    if setlimitsw = 0 then 'apply limits
    if Posit < MinPosit then Posit = MinPosit
    if Posit > MaxPosit then Posit = MaxPosit
    endif

    return

    '************************************************* ***************

    End

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Compiling problem

    Hi,

    Replace your @DEVICE ... lines by

    Code:
    ;----[12F629 Hardware Configuration]--------------------------------------------
    #IF __PROCESSOR__ = "12F629"
      #DEFINE MCU_FOUND 1
    #CONFIG
      __config  _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _BODEN_ON & _CP_OFF & _CPD_OFF
    #ENDCONFIG
    
    
    #ENDIF
    
    
    ;----[Verify Configs have been specified for Selected Processor]----------------
    ;       Note: Only include this routine once, after all #CONFIG blocks
    #IFNDEF MCU_FOUND
      #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF
    and remember to place a

    Code:
    LOW Servoout
    just before each PULSOUT command

    BTW.

    "RCTIME" is " not so good " when reading a pot because of its huge non-linearity ... ( same for the POT command )
    would be much better to use the 12F675 ( or 12F1822/1840 ) ADC , here ...

    and overall have a look to that F... Manual ... @DEVICE is something I never saw with PBP ...

    " Galaxy 76 " ... French Guy living in the N.O. of France ???
    Last edited by Acetronics2; Yesterday at 11:40.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Compiling problem

    also you can download this one ...

    https://support.melabs.com/articles/6151-meconfig

    Pretty useful, no ?
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    May 2025
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Compiling problem

    Thanks for the help, however i still can't compile. i just want a HEX. i hope someone can post it. thanks

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default Re: Compiling problem

    Quote Originally Posted by Galaxy76 View Post
    Thanks for the help, however i still can't compile. i just want a HEX. i hope someone can post it. thanks
    Strange ...

    What IDE do you use and which PBP version ???

    here, I tested with MPLAB 8.92 and PBP 3.1.6.4 ( last release )
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Replies: 19
    Last Post: - 11th October 2013, 17:55
  2. Problem for compiling SDSF library.
    By Ziko87 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th August 2012, 08:17
  3. Problem compiling EasyHID code
    By mindthomas in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th August 2010, 20:46
  4. Replies: 14
    Last Post: - 31st March 2009, 12:04
  5. Problem with Compiling
    By tarexpanda in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th April 2007, 05:12

Members who have read this thread : 5

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