Darryl's MIBAM code: won't compile for me!


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2014
    Location
    England
    Posts
    16

    Default Darryl's MIBAM code: won't compile for me!

    Hi,

    I'm trying to compile Darryl's 'Cylon' scanner demo using his Bit-angle Modulation module, under PBP3 and MPASM, which I believe is the default.

    Reference:
    http://www.picbasic.co.uk/forum/showthread.php?t=10564

    I have downloaded the file as MYBAM_TRIAL.PBP;
    In the same directory I have downloaded MYBAM.PBP;

    Without any modifications whatsoever, I get the following error message:
    [ASM ERROR] MYBAM_TRIAL.asm (193) : Overwriting previous address contents (2007)

    I would welcome some pointers to help locate the problem ...

    Thank you,

    T o n y

    /CODE

    CLEAR


    ;-- 16F887 Internal OSC @ 8Mhz ------
    @ __config _CONFIG1, _INTOSCIO & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    ANSEL = 0
    ANSELH = 0
    OSCCON = %01110001
    DEFINE OSC 8




    ;____[ For 12F/16F only - Interrupt Context save locations]_________________
    wsave var byte $20 SYSTEM ' location for W if in bank0
    ;wsave var byte $70 SYSTEM ' Alternate save location for W
    ' if using $70, comment out wsave1-3
    ' --- IF any of these next three lines cause an error ?? -------------------
    ' Comment them out to fix the problem ----
    ' -- The chip being used determines which variables are needed -------------
    wsave1 VAR BYTE $A0 SYSTEM ' location for W if in bank1
    wsave2 VAR BYTE $120 SYSTEM ' location for W if in bank2
    wsave3 VAR BYTE $1A0 SYSTEM ' location for W if in bank3
    '---DO NOT change these-----------------------------------------------------
    ssave VAR BYTE BANK0 SYSTEM ' location for STATUS register
    psave VAR BYTE BANK0 SYSTEM ' location for PCLATH register




    ;----[ MIBAM Setup ]--------------------------------------------------------
    ;BAM_FREQ CON 100 ; Desired Refresh rate Limit
    ;ScopeSync VAR PORTB.0 ; if declared, generates sync for OScope
    ;DEFINE BAM_INFO 1 ; use to display MIBAM results


    BAM_COUNT CON 8 ; How many BAM Pins are used?
    INCLUDE "MIBAM.pbp" ; Bit Angle Modulation module


    BAM_DUTY VAR BYTE[BAM_COUNT]
    LED1 VAR BAM_DUTY[0] ; group them in an array for easy access
    LED2 VAR BAM_DUTY[1] ; with FOR loops etc.
    LED3 VAR BAM_DUTY[2]
    LED4 VAR BAM_DUTY[3]
    LED5 VAR BAM_DUTY[4]
    LED6 VAR BAM_DUTY[5]
    LED7 VAR BAM_DUTY[6]
    LED8 VAR BAM_DUTY[7]


    ASM
    BAM_LIST macro ; Define PIN's to use for BAM
    BAM_PIN (PORTD,0, LED1) ; and the associated Duty variables
    BAM_PIN (PORTD,1, LED2)
    BAM_PIN (PORTD,2, LED3)
    BAM_PIN (PORTD,3, LED4)
    BAM_PIN (PORTD,4, LED5)
    BAM_PIN (PORTD,5, LED6)
    BAM_PIN (PORTD,6, LED7)
    BAM_PIN (PORTD,7, LED8)
    endm
    BAM_INIT BAM_LIST ; Initialize the Pins
    ENDASM


    ;_________________________________________________
    Speed CON 6 ; Smaller = Faster
    TracerSpeed CON 15 ; Smaller = Faster Left/Right
    Brightness CON 200 ; Tracers DutyCycle
    DrainSpeed CON 30 ; Smaller = Shorter Trail


    Idx VAR BYTE
    LoopCount VAR BYTE
    NextLED VAR BYTE
    TraceDIR VAR BIT


    TraceDIR = 0
    LoopCount = 0
    NextLED = 0

    Main:
    if LoopCount = TracerSpeed then ; __[ Cylon/Kitt Scanner ]__
    LoopCount = 0
    BAM_DUTY(NextLED) = Brightness
    if TraceDIR then ; if scanning left
    NextLED = NextLED - 1
    if NextLED = 0 then TraceDIR = 0
    else ; else scanning right
    NextLED = NextLED + 1
    if NextLED = BAM_COUNT-1 then TraceDIR = 1
    endif
    endif

    FOR Idx = 0 to BAM_COUNT - 1 ; Drain all dutycycles
    IF BAM_DUTY(Idx) > 0 then
    BAM_DUTY(Idx) = BAM_DUTY(Idx)*DrainSpeed/(DrainSpeed+1)
    ENDIF
    NEXT Idx
    pause Speed
    LoopCount = LoopCount + 1
    GOTO Main

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Darryl's MIBAM code: won't compile for me!

    See section 4.9 in the PBP3 manual regarding how to set configuration bits in your code.
    DT

  3. #3
    Join Date
    Mar 2014
    Location
    England
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Darryl's MIBAM code: won't compile for me!

    Just to complete the loop, I used the following and it worked perfectly ...

    Thank you - T o n y

    #CONFIG
    __config _CONFIG1, _INTOSCIO & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    #ENDCONFIG

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 21:52
  2. MIBAM and 12F1822...
    By alesniak in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 17th September 2011, 07:45
  3. Error when I want to compile a code with PIC18F2550
    By SKOLS1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd February 2011, 21:57
  4. MIBAM resolution
    By david parish in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th October 2009, 00:04
  5. MIBAM on 16F628
    By idtat in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2009, 13:42

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts