Using PICBASIC PRO in MPLAB IDE


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Posts
    36

    Default Using PICBASIC PRO in MPLAB IDE

    Hello. I have been writing code for some time in PBP and had a need to try to simulate it. I have gotten the code to compile in MPLAB but it tells me there are errors.

    Here is what the error message is:
    Warning[207] C:\PROJECTS\2212\HEIGHT SENSOR V02.ASM 278 : Found label after column 1. (DEVICE)
    Error[122] C:\PROJECTS\2212\HEIGHT SENSOR V02.ASM 278 : Illegal opcode (pic16F688)

    and looking at the appropriate asm file I found the lines that are for 278 are
    ; C:\PROJECTS\2212\HEIGHT SENSOR V02.PBP 00045 @ DEVICE pic16F688, PROTECT_ON

    ASM?
    DEVICE pic16F688, PROTECT_ON ' line 278

    ENDASM?

    Does anyone have any ideas? Where can I look to find out more info about what is actually happening when I compile it in MPLAB. Thanks for your help.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Sounds like you're using MPASM with PM config options.

    @ DEVICE config options are only for use with the PM assembler. You can setup MPLAB
    to use PM as the assembler, but I would stick with MPASM in the MPLAB IDE.

    Edit the default device header file to set your config options, or comment them out in
    the header file and drop them into your source.

    See this thread http://www.picbasic.co.uk/forum/showthread.php?t=543 for info on working
    with both options.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default PBP - MPLAB issues

    HI all,

    My problem is different than the original thread, but the title fits, so I'll post it here.

    I have been using MCS and PBP for a while, and never managed to really "use" MPLAB. It seem that every time I try, I fall into a "pit of death" and get frustrated and ignore it again.
    Well, I have a troublesome program, and I need to see it in a simulator. After looking around, it seems that MPLAB has it if I can figure out the hurtles. I was encouraged to try again by Chuck Hellebuyck's article in N&V and it seemed so easy. HA! again the gremlins have their way with me!

    I have MPLAB 7.60 in C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe (default) PBP is 2.47. In MPASM points to C:\PBP\PBPW.exe (default) copied the .inc files as mentioned.
    Ran PBPlugins.bat and checked the path on my computer.
    It is:
    C:\MCC;%SystemRoot%\system32;%SystemRoot%;%SystemR oot%\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\QuickTime\QTSystem\;C:Program Files\Microchip\MPASM Suite;C:\PBP



    >Executing: "C:\PBP\PBPW.EXE" -ampasmwin -oq -z -p16F690 "BLINK.BAS"
    >PICBASIC PRO(TM) Compiler 2.47, (c) 1998, 2006 microEngineering Labs, Inc. All Rights Reserved.
    >
    >ERROR: Unable to execute mpasmwin. Halting build on first failure as requested.
    >BUILD FAILED: Sat May 03 06:58:40 2008


    I reassigned the paths and got the same error.

    I would love to learn to use MPASM, but it seems that I keep running into problems like this and get frustrated.
    Can anyone see something that I’m missing?

    Thanks again
    Mark

    P.S. The whole reason for this round of gymnastics is to try and figure out a motion control glue board that I need.
    If anyone cares to look it over and offer any ideas, they would be greatly appreciated.

    I’m hoping that by seeing it in a simulator, I can get some ideas on where the problem is.

    I have been working in MicroCode Studio and using Darrel Taylor’s DT_INTS-14-0.bas for handling the interrupts.(the “-0” is a mod for 0 banks on the 12F).
    The code that I have follows:

    <code>
    ************************************************** **************
    '* Name : encTest12F675-6.BAS *
    '* Author : Mark A.Rokus *
    '* Notice : Copyright (c) 2008 Controlled Surroundings Inc. *
    '* : All Rights Reserved *
    '* Date : 4/12/2008 *
    '* Version : 6.0 *
    '* Notes : 12F675@4mhz, INT_OSC *
    '* : PBP 2.47, MPASM: 5.11, 282 words used *
    '* : Need to test *
    '* : LAST: Trav works if not too fast, Manual erratic *
    '* : and locks auto travel sometimes *
    '************************************************* ***************
    ' 1)Quadrature encoder reading direction and speed of mechanical slide.
    ' 2) Motor (servo) driven in ONE direction of slide movement,
    ' not driven for other direction. Active LOW Pulse & Direction drive.
    ' 3) another Manual Encoder to drive servo either direction manually.
    ' ADD pull-up to GPIO.3 on 12F675
    '_CONFIG INT_OSC?
    'move to different chip
    'How do you set the DEVICE for MCS & MPASM?
    ' Test "end of Travel- up" for manual feed

    A_trav VAR GPIO.0 'Travel encoder A input
    B_trav VAR GPIO.1 'Travel encoder B input
    A_man var GPIO.2 'Manual Encoder A input
    B_man var GPIO.3 'Manual Encoder B input
    P_out var GPIO.4 'PULSE output to motor, Active LOW
    D_out var GPIO.5 'LEVEL output for direction
    P_out = 1 'start out HI. Moves on LOW pulse

    TravEncOld var byte 'Travel Encoder before change
    TravEncNew Var byte 'Travel Encoder After change
    ManEncOld var byte 'Manual Encoder Before change
    ManEncNew var byte 'Manual Encoder After change
    TravCnt var word 'Counter for recent Trav Pulses
    TravDly var word 'delay to decrement Travel UP
    ManCnt var byte 'Counter for recent Man Pulses
    ManDly var byte 'count Manual I/P
    AutoCnt var word 'preprogrammed feed @ end of cycle
    EncNew1 var byte 'Stripped BITS, both Encoders
    EncNew2 var byte
    Dir VAR WORD 'Direction

    INTCON = %10001000 'GLOBAL ON, GPIO Int ON
    CMCON = 7 'Comparator off, Digital I/O
    OPTION_REG = %00000000 'GPIO Pull-up Enabled
    TRISIO = %001111
    WPU = %11111111 'weak pull-ups on 0-2,4,5
    'GPPU must be enabled for pull-ups
    IOC = %00001111 'Interrupt on Change for GPIO: 0-3
    ANSEL = 0 ' Analog off


    INCLUDE "DT_INTS-14-0.bas" 'Base Interrupt program:0 banks
    'include "ReEnterPBP-0.pbp" 'allow PBP int

    ASM
    INT_LIST macro ;IntSource, Label, Type, ResetFlag?
    INT_Handler RBC_INT, _EncChg, ASM, yes
    endm
    INT_CREATE ;creates the INT processor
    INT_ENABLE RBC_INT ;enable RB change int
    ENDASM

    Main:
    '+++++++++++
    for TravDly = 0 to 100 'Decrement delay
    TravEncOld = GPIO & (%00000011) ' Save initial value of port
    ManEncOld = GPIO & (%00001100) 'Save initial value of port
    P_out = 1 ' reset Pulse to off
    if (TravCnt > 1500) and (ManCnt > 300) then call AutoFeed 'just powered ' up stroke if TravCnt high value. If ManCnt before values depletes, jump ' to sub that feeds fixed amount of fiber out to cutting station.
    next TravDly
    While TravCnt >1 'If anything left;
    TravCnt = TravCnt - 1 'decrement after time
    wend 'if already 0 continue '
    while ManCnt > 1 'same thing with Man
    ManCnt = ManCnt -1
    Wend

    goto main
    '+++++++++++++++++++++
    'SUBS
    '+++++++++++++++++++++
    AutoFeed: 'sub to feed after up stroke
    @ INT_DISABLE RBC_INT ;hopefully disables port Int
    For AutoCnt = 1 to 4000 'Count for about 10" of fiber
    Dir = 0 'DIR to feed out
    P_out = 0 'LOW signal to driver for step
    pauseus 5 'let step get caught
    P_out = 1 'reset pulse out
    pauseus 5 'let step clear
    next AutoCnt 'repeat until ~ 10"
    @ INT_ENABLE RBC_INT ;turn port change INT back on
    Return

    '+++++++++++++++++
    'Motor Drive Pulse Out interrupt handler '++++++++++++++++++
    EncChg: 'got here if GPIO 0-3 changed
    ManEnc: 'Check Manual Enc first
    EncNew1 = GPIO & (%00001100) 'strip Manual enc.
    EncNew2 = GPIO & (%00001100) 'second read to de-glitch
    ManEncNew = EncNew1 & EncNew2 'try and average
    ' will this line cause problems?, Better Glitch Check?
    if ManEncOld = ManEncNew then TravEnc 'Not Manual, goto TravEnc
    Dir = ManEncNew.3 ^ ManEncOld.2 ' decide DIR
    ' XOR of new Left bit vs. Old Right bit gives Dir
    P_out = 0 ' start pulse either DIR
    manCnt = ManCnt +1 'track Manual I/P
    TravDly = 0 'reset TravDly
    goto EndInt 'end the interrupt


    TravEnc:
    EncNew1 = GPIO & (%00000011) 'strip Travel enc.
    EncNew2 = GPIO & (%00000011) 'second read to de-glitch
    TravEncNew = EncNew1 & EncNew2 'Did Encoder change?
    if TravEncOld = TravEncNew then EndInt 'Not TravEnc, End Int
    Dir = TravEncNew.1 ^ TravEncOld.0 'determine direction
    If DIR = 1 then EndInt 'end the INT if travel DOWN
    P_out = 0 'PULSE if UP
    TravCnt = travCnt + 1 'track travel up
    TravDly = 0 'reset TravDly
    ' may have to make binary values 5 bit instead of 8, doubt it

    EndInt:
    @ INT_RETURN

    end
    </code>
    ________________________________________

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


    Did you find this post helpful? Yes | No

    Default

    I would suggest you to download the latest version of MPLAB (V8.0x) and see if it works better.

    In your Program, you Should change
    Code:
     INT_Handler RBC_INT, _EncChg, ASM, yes
    to
    Code:
     INT_Handler RBC_INT, _EncChg, PBP, yes
    unless it might not behave the way you want. You also must include the REEnter.bas file.
    Steve

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

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by boroko View Post
    HI all,

    My problem is different than the original thread, but the title fits, so I'll post it here.

    I have been using MCS and PBP for a while, and never managed to really "use" MPLAB. It seem that every time I try, I fall into a "pit of death" and get frustrated and ignore it again.
    Well, I have a troublesome program, and I need to see it in a simulator. After looking around, it seems that MPLAB has it if I can figure out the hurtles. I was encouraged to try again by Chuck Hellebuyck's article in N&V and it seemed so easy. HA! again the gremlins have their way with me!

    I have MPLAB 7.60 in C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe (default) PBP is 2.47. In MPASM points to C:\PBP\PBPW.exe (default) copied the .inc files as mentioned.
    Ran PBPlugins.bat and checked the path on my computer.
    It is:
    C:\MCC;%SystemRoot%\system32;%SystemRoot%;%SystemR oot%\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\QuickTime\QTSystem\;C:Program Files\Microchip\MPASM Suite;C:\PBP



    >Executing: "C:\PBP\PBPW.EXE" -ampasmwin -oq -z -p16F690 "BLINK.BAS"
    >PICBASIC PRO(TM) Compiler 2.47, (c) 1998, 2006 microEngineering Labs, Inc. All Rights Reserved.
    >
    >ERROR: Unable to execute mpasmwin. Halting build on first failure as requested.
    >BUILD FAILED: Sat May 03 06:58:40 2008


    I reassigned the paths and got the same error.

    I would love to learn to use MPASM, but it seems that I keep running into problems like this and get frustrated.
    Can anyone see something that I’m missing?

    Thanks again
    Mark

    P.S. The whole reason for this round of gymnastics is to try and figure out a motion control glue board that I need.
    If anyone cares to look it over and offer any ideas, they would be greatly appreciated.

    I’m hoping that by seeing it in a simulator, I can get some ideas on where the problem is.

    I have been working in MicroCode Studio and using Darrel Taylor’s DT_INTS-14-0.bas for handling the interrupts.(the “-0” is a mod for 0 banks on the 12F).
    The code that I have follows:

    <code>
    ************************************************** **************
    '* Name : encTest12F675-6.BAS *
    '* Author : Mark A.Rokus *
    '* Notice : Copyright (c) 2008 Controlled Surroundings Inc. *
    '* : All Rights Reserved *
    '* Date : 4/12/2008 *
    '* Version : 6.0 *
    '* Notes : 12F675@4mhz, INT_OSC *
    '* : PBP 2.47, MPASM: 5.11, 282 words used *
    '* : Need to test *
    '* : LAST: Trav works if not too fast, Manual erratic *
    '* : and locks auto travel sometimes *
    '************************************************* ***************
    ' 1)Quadrature encoder reading direction and speed of mechanical slide.
    ' 2) Motor (servo) driven in ONE direction of slide movement,
    ' not driven for other direction. Active LOW Pulse & Direction drive.
    ' 3) another Manual Encoder to drive servo either direction manually.
    ' ADD pull-up to GPIO.3 on 12F675
    '_CONFIG INT_OSC?
    'move to different chip
    <FONT COLOR=RED>'How do you set the DEVICE for MCS & MPASM?</FONT COLOR>
    ' Test "end of Travel- up" for manual feed


    </code>
    ________________________________________


    Hi Mark,
    Try these ,
    Code:
    ASM
        ifndef __12F675
            error "12F675 not selected"
        endif
    ENDASM
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF 
    
        PCON = %00000011    ' BOD off, No POR flag set
    DEFINE  NO_CLRWDT 1
    DEFINE OSC 4
    
        OSCCAL = %1111100   ' SET OSC TO MAXIMUM SET OSC TO 4 MHZ INTERNAL
    Last edited by Archangel; - 4th May 2008 at 02:37.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Chip away until the only thing left is the sculpture

    Thanks guys for the replies

    I am in the process of updating to 8.10, though I doubt that will address my problem, as I think it is on my end, not the folks at microchip. And I will play with the .asm vs pbp. I think there was a reason that I went that way, but I'll have to re-discover it again.

    As for the config answer, that was great! It was actually just some notes that I left myself in the code so that I would get back to it when I had the other issues resolved. Good catch. I just re-read Melanie's thread on it and I'm still trying to get my arms around when to use which one. Can I entirely abandon PM, or do i need to mix them?
    I have been dabbling with PICs for years using different approaches, and it doesn't take much for me to get confused on which syntax gets used in which system. I have no idea how professional programmers keep 37 different languages in their heads!

    Re-reading my post, I see that there could be a bit of confusion. The issue of PBP and MPLAB playing together was related to the N&V article and I was only trying to get the famous "BLINK.BAS" to run through the system to prove that I could get it to work. As far as my program, "encTest12F675-6.BAS" to get to the point that I could watch it on the simulator, well, that's a bit far off. I'm not sure if I can just open the .bas and see it, or if I have to jump through some extra hoops. I imagine it's seen as a source file and I need to have the Header File for the Include there, but what about the linker? Does it matter if I get it in the wrong section (Source, Header, object, library, linker, other)?
    Because PBP and MPLAB are from different companies, there doesn't seem to be a comprehensive set of instructions that covers the integration of them. Hours of searching the forum (using the Google ver.) all I get are partial answers or squeals of excitement from people that got it to play well. I think I just need to drive to Colorado Springs and pay Jeff Schmoyer his hourly rate and sit by his side for a few days until my dim bulb starts to give off some light :-) [rant mode-off]
    Thanks again for all the help. I'll keep banging my head... there has to be a door here somewhere..
    Mark

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Mark,
    Check out this months Nuts & Volts, Chuck H. has an article ( I have not read it yet. . . much ) where he uses (at least I think he does) MPLAB and PBP together. As far as PM vs MPASM, most here use only MPASM, except NOOBS who haven't figured out how to change. WHY? I figure it is because the same people who make the chips made it . . .
    Thanks again for all the help. I'll keep banging my head... there has to be a door here somewhere..
    I wouldn't do that, makes you stay up nights in clubs playing bad rock and roll . . .


    Cheers,
    JS
    Last edited by Archangel; - 4th May 2008 at 03:48.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  8. #8
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Red face re-noob

    Sadly enough, I have been around them for too long to have any excuses. Been hiding in the lower levels though and haven't really learned them well for anything but the simple stuff.

    As far as Chuck's article, that's what got me to try it again. I fired off a note to him and tried not to sound too whiny. I hate it when people ask me questions that they should already know and that's why I'm frustrated having to ask here. Thanks for the patience.

    mark

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    No Sweat Mark,
    I have been too busy to write anything lately, this helps me keep the rust from overwhelming me, I will help where I can, for sure I am no expert.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Conversion from picbasic pro to hex for mplab
    By pr2don in forum Forum Requests
    Replies: 5
    Last Post: - 10th October 2010, 19:53
  2. picbasic pro and mplab IDE
    By soelinnhtet in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st March 2010, 08:57
  3. 16F636 Picbasic pro 2.60 / MPLAB 8.43 / Windows 7
    By mathubbard in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th February 2010, 15:50
  4. PICBASIC Pro & MPLAB integration syllabus
    By chris vp in forum PBP Wish List
    Replies: 16
    Last Post: - 25th July 2009, 10:35
  5. Upgraded to MPLAB IDE 8.14 and now I'm stuck
    By BlueHairBob in forum General
    Replies: 2
    Last Post: - 20th August 2008, 01:15

Members who have read this thread : 2

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