pbp 3 and MPLAB X


Results 1 to 34 of 34

Threaded View

  1. #25
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: pbp 3 and MPLAB X

    Hi, Charles

    just a little error I Can't explain ...


    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Train_Rentrant.X'
    make -f nbproject/Makefile-default.mk dist/default/production/Train_Rentrant.X.production.hex
    make[2]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Train_Rentrant.X'
    gnumkdir -p build/default/production
    "C:\PBP3\PBPX.EXE" -ampasmx -k# -os -p16f628 Train_R.pbp
    Error[113] C:\PBP3\PBPPIC14.LIB 451 : Symbol not previously defined (TMR1)
    Error[113] C:\PBP3\PBPPIC14.LIB 465 : Symbol not previously defined (TMR1)
    Error[113] C:\PBP3\PBPPIC14.LIB 479 : Symbol not previously defined (TMR1)
    .
    .
    .
    Compiles ( and runs in real life ... ) fine with MPLAB 8.84, but doesn't want to compile with MPLABX ...

    looks a definition for TMR1 ( as a word ) is missing somewhere ... but where ???

    Here is the program
    Code:
    '****************************************************************
    '*  Name      : Train_Rentrant
    '*  Author    : Alain
    '*  Notice    : Copyright (c) 2010
    '*            : All Rights Reserved
    '*  Date      : 9 avr. 2012
    '*  Version   : 1.0
    '*  Processor :
    '*  Notes     : Gestion de train rentrant électrique
    '*            :
    '****************************************************************
    
    '******************************************************************************
    'Configuration
    '******************************************************************************
    #CONFIG
        __CONFIG  _BODEN_ON &_CP_OFF & _PWRTE_ON & _WDT_ON & _LVP_OFF & _MCLRE_ON  & _XT_OSC
    #ENDCONFIG
    '******************************************************************************
    'Config Timer 1
    T1CON  = 110100     ' 1/8, internal osc,stopped
    INTCON = 000000
    PIE1 = 000001
    PIR1 = 0
    TMR1 = 0
    '******************************************************************************
    'Definitions
    '******************************************************************************
    DEFINE PULSIN_MAX 2500
    DEFINE BUTTON_PAUSE 255
    '******************************************************************************
    'Definitions
    '******************************************************************************
     Temp  var Word
     Servoval var Word
     mesure      var Byte
     meanval     var Byte
     dureeprog   var Byte
     Pos1  var Byte
     Pos2  var Byte
     Timecounter var Byte
     echantil    var Byte
     delay  var Byte
     side        var byte
     Timeout  var Byte
     CLEAR
    '******************************************************************************
    ' I/Os
    '******************************************************************************
     Sorti       var PORTA.0 ' Closed = GND
     Rentre  var PORTA.1 ' Closed = GND
     LedA  var PORTA.2
     LedB        var PORTA.3 
     prog       var PORTB.0 ' jp2 reglage enclenchement
     Signal  var PORTB.1 ' Entrée Signal
     Boost  var PORTB.3 ' Sortie PWM
     T2   var PORTB.4
     T3   var PORTB.5
     T8   var PORTB.6 
     T5   var PORTB.7 
    '******************************************************************************
    'Initialisation des ports
    '******************************************************************************
     CMCON  = 7    ' All digital
     PORTA   = 0
     PORTB   = 000000
     TRISA  = 000011
     TRISB  = 000011
     Neutre   CON 150
     Traveltime  CON 50
     DATA @1,180,170,130,1   ' Protection 1ère utilisation 
    '******************************************************************************
    'Lecture des valeurs en EEPROM
    '******************************************************************************
    
     READ 1, Dureeprog, Pos1, Pos2, Side
     IF dureeprog <> 255 THEN start
    
    '******************************************************************************
    'Mesure de l'impulsion d'enclenchement
    '******************************************************************************
    mesurepro:
     dureeprog = 255
    
     LOW LedA
     LOW LedB
    mesurep:
    
     LedA  = 0   ' Led Verte
     LedB  = 1
     FOR echantil = 1 to 50
     PULSIN Signal,1,mesure
     IF ( mesure < 75) OR ( mesure > 220 ) THEN
      GOTO mesurep
     ENDIF
    
     IF dureeprog = 255 THEN valable
    ' Stability check
     IF ( mesure < ( dureeprog - 1 )) OR ( mesure > ( dureeprog + 1 )) THEN
      GOTO mesurep
     ENDIF
    ' Valid mesure
    valable:
     dureeprog = mesure
    
     NEXT echantil
     LedB  = 0
     delay  = 0
     BUTTON prog,0,255,0,delay,1,mesurepro 'Enlever le cavalier 
    '******************************************************************************
    ' Calcul Pos1, Pos2
    '******************************************************************************
     SELECT CASE Dureeprog
      CASE is => ( Neutre + 20 )
       Pos1  = ( Dureeprog - 10 )
       Temp  = 2*Neutre - Pos1
       Pos2  = Temp
       Side = 1
     
      CASE is < ( neutre - 20 )
     
       Pos1  = ( Dureeprog + 10 )
       Temp  = 2*Neutre - Pos1
       Pos2  = Temp
       Side = 0
      CASE ELSE
        IF Dureeprog => Neutre THEN
         Pos1 = Neutre + 10
         Pos2 = Neutre - 10
         Side = 1
        ELSE
         Pos1 = Neutre - 10
         Pos2 = Neutre + 10
         Side = 0
        ENDIF
     END SELECT
     WRITE 2,Pos1, Pos2, Side    ' Save Switching Positions
    '******************************************************************************
    '******************************************************************************
    start:
    '******************************************************************************
     IF Timeout THEN      ' Locking for Timeout
      GOTO NoSignal  
     ENDIF
     Servoval = 0
     
     FOR Echantil = 1 to 5     ' Check 5 cycles and take mean value
     
      PULSIN Signal,1,mesure
     
       IF ( mesure < 75) OR ( mesure > 220 ) THEN
      
        GOTO  NoSignal
      
       ENDIF
     
      IF Meanval = 0 THEN Valable1
     ' Stability check
     
      IF ( mesure < ( meanval - 2 )) OR ( mesure > ( meanval + 2 )) THEN
     
       GOTO start    ' Reset cycle   
     
      ENDIF
     
     Valable1:
     
      Servoval = Servoval + mesure
     
      NEXT echantil
     Meanval = Servoval/5
    '******************************************************************************
    '
     IF Side THEN
      SELECT CASE Meanval
       
       CASE is => pos1
        'IF T2CON.2 = 0 THEN HPWM 1,127,20000 
        GOTO UP       ' _________________  Gear UP       
      
       CASE is <  pos2
        'IF T2CON.2 = 0 THEN HPWM 1,127,20000
        GOTO DOWN      '__________________  Gear DOWN      
       
       CASE Else
        'IF T2CON.2 = 1   THEN HPWM 1,0,20000 
        GOTO NoMove      ' _________________  Gear LOCKED
       
      END SELECT
     ELSE
      SELECT CASE Meanval
       
       CASE is <= pos1
        'IF T2CON.2 = 0 THEN HPWM 1,127,20000
        GOTO UP       ' _________________  Gear UP
      
       CASE is >  pos2
        'IF T2CON.2 = 0 THEN HPWM 1,127,20000
        GOTO DOWN      '__________________  Gear DOWN 
       
       CASE Else
        'IF T2CON.2 = 1   THEN HPWM 1,0,20000 
        GOTO NoMove      ' _________________  Gear LOCKED
       
      END SELECT
     ENDIF
    '*****************************************************************************
    UP:
    '*****************************************************************************
     IF Rentre = 0 OR Timeout THEN ' Verification fins de course
                
      T1CON.0 = 0    ' Stop the timer
      TMR1.0 = 0    ' Reset the timer
      LedA = 1    ' Solid GREEN Led
      LedB = 0
      GOTO NOMOVE
     ENDIF 
     
     T1CON.0  = 1 
     LOW  T8     ' T8 + T3 OFF
     LOW  T3
     PAUSEUS 100
     HIGH  T5     ' T5 + T2 ON
     HIGH  T2
     LedA  = 0
     IF PIR1.0 THEN
       LedB = ~ LedB
      TMR1 = 0
      TimeCounter = Timecounter + 1
     
      IF Rentre THEN 
       IF timecounter => TravelTime THEN
           Timeout = 1
        GOSUB NoMove
       ENDIF
      ELSE
       GOSUB NoMove
      ENDIF
     
     ENDIF
     
     TMR1.0  = 1
     PIR1.0  = 0      ' Clear Flag
     GOTO Start
     
    '*****************************************************************************
    DOWN:
    '*****************************************************************************
     IF Sorti = 0 OR Timeout THEN   ' Verification fins de course 
                
      T1CON.0 = 0    ' Stop the timer
      TMR1.0 = 0    ' Reset the timer
      LedA = 0    ' Solid RED Led
      LedB = 1
      GOTO NOMOVE
     ENDIF 
     T1CON.0 = 1
     LOW  T5     ' T5 + T2 OFF     
     LOW  T2
     PAUSEUS 100
     HIGH  T8     ' T8 + T3 ON
     HIGH  T3
     IF PIR1.0 THEN 
      LedA  = ~ LedA
      TMR1  = 0
      TimeCounter = Timecounter + 1
     
     
       IF Sorti THEN
        IF timecounter => TravelTime THEN 
         Timeout = 1
         GOTO NoMove
        ENDIF
       ELSE
        GOTO NoMove
       ENDIF
      ENDIF
     LedB   = 0
     T1CON.0  = 1
     PIR1.0   = 0      ' Clear Flag
     GOTO Start
     
    '*****************************************************************************
    NOMOVE: ' Bridge switched OFF , Led Remains unchanged
    '*****************************************************************************
     'Brake a While
     LOW  T5     ' Hi part of Bridge OFF
     LOW  T8
     Pauseus 100
     HIGH T2     ' Low part of Bridge ON    
     HIGH  T3
     PAUSE 500
     
    ' LOW  T5     ' Hi Bridge OFF
    ' LOW  T8     
     LOW  T2     ' Low Bridge OFF
     LOW  T3
     GOTO Start
    '*****************************************************************************
    NoSignal:
    '*****************************************************************************
     IF PIR1.0 THEN 
      LedA = ~ LedA
      TMR1 = 40536    ' Quick 5Hz RED Flash
      PIR1.0  = 0      ' Clear Flag
     ENDIF
     
     LedB  = 0
     T1CON.0  = 1
     
     GOTO Start
    '*****************************************************************************
    '***************************************************************************** 
     END
    Alain
    Last edited by Acetronics2; - 17th April 2012 at 21:22.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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