+ Reply to Thread
Results 1 to 29 of 29
  1. #1
    Join Date
    Oct 2005
    Posts
    26

    Default pbp 3 and MPLAB X

    Anybody has success in setup MPLAB-X, ICD3 and Picbasic3 ?
    Actually I'm able to write a simple program, build but then an error

    BUILD SUCCESSFUL (total time: 2s)
    Loading C:/Users/Marco/Desktop/Nuova cartella/prova.X/dist/default/production/prova.X.production.cof...
    Loading C:/Users/Marco/Desktop/Nuova cartella/prova.X/dist/default/production/prova.X.production....
    The program file could not be loaded: java.lang.NullPointerException

    ICD3 works fine with MPLAB 8
    Marco


    Hi, we are pleased to see that you are using our forum.

    We'd like you to become a member of our community. Membership is FREE, please REGISTER and view our forums without these annoying reminders!

    Once registered you may post on the forums, download from the file areas and use the WIKI without interruption.





  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,276

    Default Re: pbp 3 and MPLAB X

    My theory is keep it simple. So I use what Melabs gives with PBP3, the MCSX. When I was using ICD3 as a programmer, I just loaded the hex file in MPLAB8.xx and programed the chip.

    Now I find Pickit2 or 3 much more easy to use, specially with the stand alone program.

    Out of curiosity, I wonder what MPLABX can offer more as na IDE. Please elaborate on this if you have the time.

    Ioannis

  3. #3
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    well, because I have these three products, I just want to know if they must work or if actually there are a lot of compatibility problems.

    PBP3 says it works with MPLABX
    MPLABX says it works with ICD3

    These three parts works togheter or not ?
    Marco

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    2,428

    Default Re: pbp 3 and MPLAB X

    Marcick,
    I'm afraid I can't help much. I tried to get PBP3 integrated in MPLABX but couldn't even manage to get that working. But anyway, have you seen this page? There's a topic about installing the ICD3. Unfortunately the page doesn't exist but perhaps you can find some other pointers as to where the problem might be.

    Ioannis,
    Out of curiosity, I wonder what MPLABX can offer more as na IDE.
    Well, compared to MCSX, here are three things that I personally would like to have (and that MPLABX offers).

    * Source level debugging
    * Code folding
    * Version control

    But, as I said, I couldn't even manage to integrate PBP into the thing so until someone more intelligent than me writes a step by step guide I'll stick with MCSX.

    /Henrik.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,276

    Default Re: pbp 3 and MPLAB X

    Source level debuging would be nice, but is it valid for a higher level lanquage like PBP or is it possible only for ASM or C?

    If this works for PBP, I want it and may do the experiments

    Ioannis

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    2,428

    Default Re: pbp 3 and MPLAB X

    Hi,
    PBP source level debugging works with MPLAB 8 so it should work with MPLABX as well.

    /Henrik.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,276

    Default Re: pbp 3 and MPLAB X

    Henrik, I think you are refering to an example of Bruce about this?

    I am trying to locate this. Any help appreciated.

    Ioannis

  8. #8
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,527

    Default Re: pbp 3 and MPLAB X

    Marcick, that's a pretty long folder path. It could be complaining about that. I think I had some problems when my folders were that long, so I made them shorter.

    I followed the instructions here: http://support.melabs.com/threads/91-Mplab-X
    But I did have a heck of a time. I tried it on two separate computers, and it seemed to me that on both of them I needed to install the PBP2.60 plugin first (don't ask me why that helped) first, to get PBP3 to work.

    Here are some pictures of the settings I currently have, and a screen shot of code stepping PBP3 in MPLABX.



    Click image for larger version

Name:	plugins.png
Views:	2474
Size:	81.7 KB
ID:	6352

    Click image for larger version

Name:	build-tools.png
Views:	2383
Size:	84.4 KB
ID:	6353

    Click image for larger version

Name:	step-sim.png
Views:	2466
Size:	286.2 KB
ID:	6354
    http://www.scalerobotics.com

  9. #9
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    Thanks to everybody,
    now that I see it must work, I'll stuck my head til it worsk for me too ...
    After try and try now I have a different error:

    ERROR: Unable to find proper .org_n section in file C:\Pbpx\prova.X\pippo.O
    Error processing COFF file C:\Pbpx\prova.X\pippo.O
    make[2]: *** [build/default/production/pippo\.cof] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    make[2]: Leaving directory `C:/Pbpx/prova.X'
    make[1]: Leaving directory `C:/Pbpx/prova.X'



    How to install the PBP2.60 plugin also now that I have 3 ?

  10. #10
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    Sorry, I correct my previous post:
    I can build with success a simple program, but then the error is the same:

    BUILD SUCCESSFUL (total time: 2s)
    Loading C:/Pbpx/prova.X/dist/default/production/prova.X.production.cof...
    Loading C:/Pbpx/prova.X/dist/default/production/prova.X.production....
    The program file could not be loaded: java.lang.NullPointerException

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    1,946

    Default Re: pbp 3 and MPLAB X

    Could it be a problem with long file destination again?

    Robert

  12. #12
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,527

    Default Re: pbp 3 and MPLAB X

    All is not exactly rosy over here either.

    I do get a file not found error, after I successfully compile. Which I notice is slightly different than you. Are you using the new MPLAB X 1.0 (first non beta)?

    I can run through with the simulator, I can create hex files that I tested to make sure they really worked. But in my testing of MPLAB X, I can't seem to program the devices directly from MPLAB X when using PBP3. For C, the programmers all work, ICD3, Pickit3. I notice in MPLAB X PBP3, the .cof file is put in \dist\default\production file of the project, but the hex is left in the base file of the project. This is not how it works in MPLAB X C. The hex file and the cof file would be found in the \dist\default\production file for C. So I am wondering if the error I am getting is the rest of MPLAB not finding the hex where it thought it would be. This leads me to wonder if the plugin is set right? This doesn't look like any settings I can select, as far as I can tell. I will ask Charles Leo on the MeLabs site, and pass the answer here when he responds.

    Here is a my compiling message:

    CLEAN SUCCESSFUL (total time: 101ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/local/new/altimeter.X'
    make -f nbproject/Makefile-default.mk dist/default/production/altimeter.X.production.cof
    make[2]: Entering directory `C:/local/new/altimeter.X'
    gnumkdir -p build/default/production
    "C:\PBP3\PBPX.EXE" -ampasmx -k# -os -p12f683 alt-683.pbp
    PICBASIC PRO(TM) Compiler 3.0.4.4, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    gnumkdir -p dist/default/production
    cp alt-683.COF dist/default/production/altimeter.X.production.cof
    rm -f alt-683.COF
    make[2]: Leaving directory `C:/local/new/altimeter.X'
    make[1]: Leaving directory `C:/local/new/altimeter.X'

    BUILD SUCCESSFUL (total time: 3s)
    Loading C:/local/new/altimeter.X/dist/default/production/altimeter.X.production.cof...
    The program file could not be loaded: File not found.
    http://www.scalerobotics.com

  13. #13
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    Thank you guys,
    Yes, I'm using MPLAB X 1.10, the version actually available for download.
    I don't think it's a problem of long paths. I've choosen c:\pbpx for my development and the other subpath are choosen from MPLAB. I can't do anything else to make the path shorter ...
    Hope Charles will solve everything ...
    Marco

  14. #14
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,527

    Default Re: pbp 3 and MPLAB X

    Ok, I uninstalled MPLAB X 1.00 (required for "upgrade") and installed MPLAB X v1.10, I was asked during install if I wanted to use the old settings, I selected yes.

    Now I get no errors after build, and my .hex file ends up in the correct spot. Seems to me, this is something corrected in MPLAB X v1.10

    Now I am able to get the Pickit3 to program my project from MPLAB X v1.10. Yay!

    I am now wondering if your errors could be a Java problem, with incorrect version. What do you get when you click on help, and info?

    Here is mine:

    Click image for larger version

Name:	java.png
Views:	2287
Size:	142.2 KB
ID:	6357

    Results:

    CLEAN SUCCESSFUL (total time: 101ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/local/new/altimeter.X'
    make -f nbproject/Makefile-default.mk dist/default/production/altimeter.X.production.hex
    make[2]: Entering directory `C:/local/new/altimeter.X'
    gnumkdir -p build/default/production
    "C:\PBP3\PBPX.EXE" -ampasmx -k# -p12f683 alt-683.pbp
    PICBASIC PRO(TM) Compiler 3.0.4.4, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    gnumkdir -p dist/default/production
    cp alt-683.HEX dist/default/production/altimeter.X.production.hex
    cp alt-683.COF dist/default/production/altimeter.X.production.cof
    rm -f alt-683.COF
    make[2]: Leaving directory `C:/local/new/altimeter.X'
    make[1]: Leaving directory `C:/local/new/altimeter.X'

    BUILD SUCCESSFUL (total time: 4s)
    Loading C:/local/new/altimeter.X/dist/default/production/altimeter.X.production.hex...
    Loading C:/local/new/altimeter.X/dist/default/production/altimeter.X.production.cof...
    Loading completed
    Last edited by ScaleRobotics; - 20th March 2012 at 17:09.
    http://www.scalerobotics.com

  15. #15
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    wow, happy for you ...
    My java version results 1.6.0_31 that seems newer than yours.
    Name:  Cattura.JPG
Views: 2142
Size:  77.1 KB

  16. #16
    Join Date
    Sep 2007
    Posts
    32

    Default Re: pbp 3 and MPLAB X

    After updating all of my software, I have the same problem as Marcick. I've been in touch with Microchip and I'm told that the hex file handling needs to be updated in our plugin. I hope to have a new plugin packaged with MPLABX 1.20.

    I'm still a bit confused as to why some installations work and some don't.
    Charles Leo
    microEngineering Labs, Inc.
    http://melabs.com

  17. #17
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,527

    Default Re: pbp 3 and MPLAB X

    Very interesting. Thanks Charles for looking in to it, and trying to update the plugin for the next MPLAB X release!

    It worked on both Windows 7 professional 32 bit, and Windows 7 professional 64 bit here.

    On the 32 bit, my info seems to be the same as Marcick's execpt for I have

    Java 1.6.0_26, and he has 1.6.0_31
    java hotspot 20.1-b02 , and he has 20.6-b01:

    Click image for larger version

Name:	win732.png
Views:	2196
Size:	105.6 KB
ID:	6361

    I may try updating my Java and see if it breaks my setup, or try a fresh install on a different computer. Will let you know what I find.
    Last edited by ScaleRobotics; - 21st March 2012 at 15:37.
    http://www.scalerobotics.com

  18. #18
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    no news ?
    marco

  19. #19
    Join Date
    May 2004
    Location
    Le Treport 76 FRANCE
    Posts
    3,340

    Default Re: pbp 3 and MPLAB X

    Hi,

    using Win SP3 Home / I7 2600K ... and a Pickit2.
    of course everything ( java, pbp, etc ... ) up to date ...

    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    make -f nbproject/Makefile-default.mk dist/default/production/Servotest.X.production.cof
    make[2]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    gnumkdir -p build/default/production
    "C:\PBP3\PBPX.EXE" -ampasmx -k# -os -p16f887 Servotes.pbp
    PICBASIC PRO(TM) Compiler 3.0.5.4, (c) 1998, 2012 microEngineering Labs, Inc.
    All Rights Reserved.
    gnumkdir -p dist/default/production
    cp Servotes.COF dist/default/production/Servotest.X.production.cof
    rm -f Servotes.COF
    make[2]: Leaving directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    make[1]: Leaving directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    BUILD SUCCESSFUL (total time: 3s)
    Loading C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X/dist/default/production/Servotest.X.production.cof...
    Loading C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X/dist/default/production/Servotest.X.production....
    The program file could not be loaded: java.lang.NullPointerException
    may I add my graphics card ( an ATI Radeon 6870 ...) doesn't like MPLABX at all and frequently crashes ...
    but everything is fine With MPLAB 8.84 ...

    Alain
    Last edited by Acetronics; - 27th March 2012 at 17:53.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  20. #20
    Join Date
    Sep 2007
    Posts
    32

    Default Re: pbp 3 and MPLAB X

    I just kicked back a beta version for a minor fix. I hope to release an updated plugin tomorrow.
    Charles Leo
    microEngineering Labs, Inc.
    http://melabs.com

  21. #21
    Join Date
    Mar 2012
    Posts
    2

    Default Re: pbp 3 and MPLAB X

    Up

    same problem:
    "The program file could not be loaded: java.lang.NullPointerException"

  22. #22
    Join Date
    Sep 2007
    Posts
    32

    Default Re: pbp 3 and MPLAB X

    I've updated the plugin download.

    http://pbp3.com/downloads/com-melabs-pbptoolchain.zip

    Let me know what you find.

    I tested with a PICkit3. Source-level debugging works and it will show PBP variables in the watch window.

    MPLABX still seems a bit spotty for debugging. I'm hoping for some improvement in version 1.20.
    Charles Leo
    microEngineering Labs, Inc.
    http://melabs.com

  23. #23
    Join Date
    Oct 2005
    Posts
    26

    Default Re: pbp 3 and MPLAB X

    Hi Charles,
    I still have to understand how MPLABX works, but I can confirm that with the udated plugin I no longer have that java error after build.
    I'll come back here again next week. For the moment, many thanks.
    Marco

  24. #24
    Join Date
    Mar 2012
    Posts
    2

    Default Re: pbp 3 and MPLAB X

    Quote Originally Posted by Charles_Leo View Post
    I've updated the plugin download.

    http://pbp3.com/downloads/com-melabs-pbptoolchain.zip

    Let me know what you find.

    I tested with a PICkit3. Source-level debugging works and it will show PBP variables in the watch window.

    MPLABX still seems a bit spotty for debugging. I'm hoping for some improvement in version 1.20.

    Thank you, Charles

    No errors with new plugin.

    Fabio

  25. #25
    Join Date
    Nov 2009
    Location
    Virginia, USA
    Posts
    12

    Default Re: pbp 3 and MPLAB X

    Quote Originally Posted by Charles_Leo View Post
    I've updated the plugin download.

    .
    Works like a charm for me also. Thanks !
    Gary-W4GNS
    MicroCode Studio Plus 5.0.0.2 MCSPX
    PBP 3.0 Gold Edition 3.0.5.4

    Tickled Speechless using PBP 3.0

  26. #26
    Join Date
    May 2004
    Location
    Le Treport 76 FRANCE
    Posts
    3,340

    Default Re: pbp 3 and MPLAB X

    Hi, SupaCharles

    Works fine here :


    CLEAN SUCCESSFUL (total time: 62ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    make -f nbproject/Makefile-default.mk dist/default/production/Servotest.X.production.hex
    make[2]: Entering directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    gnumkdir -p build/default/production
    "C:\PBP3\PBPX.EXE" -ampasmx -k# -os -p16f887 Servotes.pbp
    PICBASIC PRO(TM) Compiler 3.0.5.4, (c) 1998, 2012 microEngineering Labs, Inc.
    All Rights Reserved.
    gnumkdir -p dist/default/production
    cp Servotes.HEX dist/default/production/Servotest.X.production.hex
    cp Servotes.COF dist/default/production/Servotest.X.production.cof
    rm -f Servotes.COF
    make[2]: Leaving directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    make[1]: Leaving directory `C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X'
    BUILD SUCCESSFUL (total time: 3s)
    Loading C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X/dist/default/production/Servotest.X.production.hex...
    Loading C:/Program Files/Microchip/MPLAB IDE/Projets/X/Servotest.X/dist/default/production/Servotest.X.production.cof...
    Loading completed
    lots of thanks to you once more ...

    Alain
    Last edited by Acetronics; - 29th March 2012 at 17:31.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  27. #27
    Join Date
    May 2004
    Location
    Le Treport 76 FRANCE
    Posts
    3,340

    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 Acetronics; - 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 " !!!
    *****************************************

  28. #28
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,955

    Default Re: pbp 3 and MPLAB X

    The 16F628.inc file for MPASMX doesn't have an EQU for TMR1.
    The 16F628.inc file for MPASM in MPLAB 8 does have TMR1.

    You can add this to your program for a workaround ...

    Code:
    ASM
        ifndef TMR1
    TMR1 = TMR1L
        endif
    ENDASM
    DT

  29. #29
    Join Date
    May 2004
    Location
    Le Treport 76 FRANCE
    Posts
    3,340

    Default Re: pbp 3 and MPLAB X

    Hi, Darrel

    Thanks for the tip.

    I finally have modified the Mpasmx .inc file ...

    With PBP3 there is no more need to modify the PBP . inc files .... but the Mpasmx have to be now ....

    You right : customers ALWAYS complain !!!

    Alain
    ************************************************** ***********************
    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 : 17

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