MIBAM and 12F1822...


Closed Thread
Results 1 to 28 of 28
  1. #1
    Join Date
    Aug 2011
    Posts
    12

    Question MIBAM and 12F1822...

    first off greetings, been a long time lurker here, can't even remember the number of times posts from this forum has saved me, usually when I'm stuck a quick search get's me unstuck with ease... so thank you everyone.

    now for the stuck part...

    I've been using Darryl's awesome MIBAM with a 12F683 for some time, just
    some fading rgb led's etc.. nothing fancy, everything works great...

    enter the 12F1822, was hoping to eventually utilize the hardware EUSART to send rgb color data to each led, since using MIBAM pretty much rules out any software serial communication on the 683. (and not quite sure when the 12F1501 will be available with 4xPWM)

    So before I go any further I wanted to just setup a simple test program to make sure things in general are working..

    here's how the pic is wired up..


    here is my code for basic testing
    Code:
    '****************************************************************
    '     MIBAM TEST pic12F683 / pic12f1822                         *
    '****************************************************************
    
    #IF __PROCESSOR__ = "12F1822"
        #MSG "Compililng for 12F1822..."
        #CONFIG
           __config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF
           __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
        #ENDCONFIG
        OSCCON = %01110000        '8mhz
        TRISA  = %00011000        'setup inputs/outputs
        ANSELA = %00010000        'RA4 = analog
        CM1CON0 = 0               'disable comarators
        ADCON0 = %00001101        'Select AN3 enable ADC
        ADCON1 = %11010000        'Right Justify - Fosc/16 & 8mhz
    #ELSE
        #if __PROCESSOR__ = "12F683"
            #msg "Compiling for 12F683..."
            #CONFIG
                __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
            #ENDCONFIG
            OSCCON = %01110001       '8mhz
            TRISIO = %00011000       'setup inputs/outputs
            ANSEL  = %01011000       'RA4 = analog
            CMCON0 = %00000111       'disable comarators
            ADCON0 = %10001101       'Right Justify - Fosc/16 & 8mhz
        #else
            #ERROR "Only 12F1822 & 12F683 are supported!"
        #endif
    #ENDIF
    
    DEFINE OSC 8              '8mhz
    DEFINE ADC_BITS 10        '10 bit ADC
    
    DEFINE DEBUG_REG PORTA    
    DEFINE DEBUG_BIT 5
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 0
    
    ;____[ 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_COUNT CON 3                     ; How many BAM Pins are used?
    INCLUDE "MIBAM.pbp"                 ; Mirror Image BAM module
    
    RED  VAR BYTE
    GRN  VAR BYTE
    BLU  VAR BYTE
    adc_val var word                    'adc value variable
    adc_thresh var word                 'adc trigger threshold variable
    
    ASM
    BAM_LIST  macro                     ; Define PIN's to use for BAM
         BAM_PIN (PORTA,0, BLU)         ;   and the associated Duty variables
         BAM_PIN (PORTA,1, RED)
         BAM_PIN (PORTA,2, GRN)
      endm
      BAM_INIT  BAM_LIST                ; Initialize the Pins
    ENDASM
    
    Speed CON 5         'led fade speed   
    adc_thresh = 300    'trigger threshold
    red = 0
    blu = 0
    grn = 0  
    
    T1CON.0 = 0 'disable mibam
    debug "Program Start..",13,10
    pause 2
    T1CON.0 = 1 'enable mibam
    
    'test MIBAM turn on and fade each led 
    FOR red = 255 to 1 STEP -1
        PAUSE Speed
    NEXT red
    red = 0
        
    FOR grn = 255 to 1 STEP -1
        PAUSE Speed
    NEXT grn
    grn = 0
        
    FOR BLU = 255 to 1 STEP -1
        PAUSE Speed
    NEXT BLu
    blu = 0
    
    '------------------------ MAIN PROGRAM LOOP ------------------------
    main:
        gosub do_adc 'get ADC reading
        pause 20
        
        T1CON.0 = 0 'disable mibam
        debug "ADC: ",dec4 adc_val,13,10
        pause 2
        T1CON.0 = 1 'enable mibam
        
        if adc_val > adc_thresh then 
        
            FOR red = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT red
            red = 0
            
            FOR grn = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT grn
            grn = 0
            
            FOR BLU = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT BLu
            blu = 0
            
        endif  
    goto main
    
    '----------------------------------------------------------------------
    
    Do_Adc:
        pauseus 50
        ADCON0.1=1
        WHILE ADCON0.1 : WEND
        adc_val.highbyte = ADRESH
        adc_val.lowbyte = ADRESL
        return

    when compiled for 12F683, everything works fine... the test program does.
    1. debug output --> "Program Start..."
    2. lights up and fades each led r/g/b
    3. debug output ADC reading
    4. waits for ADC threshold to >300 then triggers the light sequence again.

    now when I first compiled for 12F1822 I was greeted with the following error
    Code:
    PICBASIC PRO(TM) Compiler 3.0.0.4, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    [MESSAGE] ledtest.pbp(13): Compililng for 12F1822...
    [ASM ERROR] LEDTEST.ASM (451) : Illegal opcode (_CylonMask)
    [ASM WARNING] LEDTEST.ASM (451) : Found label after column 1. (rrcf)
    [ASM ERROR] LEDTEST.ASM (459) : Illegal opcode (_CylonMask)
    [ASM WARNING] LEDTEST.ASM (459) : Found label after column 1. (rlcf)
    [ASM WARNING] LEDTEST.ASM (547) : Extraneous arguments on the line
    not being one to give up so fast... started to track down what is causing the error message... discovered the following in MIBAM.bas.

    Code:
    ;----[ makes rrf work on 18F's ]--------------------------------------------
    ASM nolist
      ifdef BSR
        #define rrf rrcf
        #define rlf rlcf
      endif 
      list ENDASM
    if I comment out the #define's the program does compile successfully however mibam begins to work correctly and then stops working. The following happens.
    1. debug output --> "Program Start..."
    2. lights up and fades each led r/g/b
    3. debug output ADC reading
    4. waits for ADC threshold to >300 *FAILS* to tigger the light sequence.

    basically you can see that the loops are running due to the pause in debug output but the leds now stay off...

    I am assuming that because the 12F1822 is a new part with added features such as automatic context saving etc, I need to do some changes to the MIBAM code, but I really am not sure where to start.. looking to see if anyone has tried using MIBAM on newer pics?

    untill then going to go brush up on my assembly knowledge some and see what trouble I can get myself into changing things...

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    OK so the new parts have BSR which were only available on 18Fs before hence why There's quite a fer IFDEF BSR in MIBAM's code. Spot them and change them accordingly. I think it should work after that. Unfortunately I don't have this spêcific PIC on hand to test drive it
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    try the one in the attachement.

    Attachment removed.
    The program was completely destroyed by the modifications.
    Last edited by Darrel Taylor; - 29th August 2011 at 03:45.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Another thing... RA4 = AN3, so you need to modify your ANSELA line
    Steve

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

  5. #5
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Thanks for the help!

    so just tried the modMIBAM code, unfortunatly still getting strange results. different results but still not correct..

    so now the led's do the initial test light up and fade, r/g/b and then when I
    trigger the adc threshold it does work but only the first 1-3 times then the
    led stops working. hmmm must be something else that needs to be modified..

    I was wondering about this section of MIBAM code as well.
    Code:
      ifdef BSR                      ; 18F
        variable ReloadCount   = 5
        variable Latency       = 6
        variable ExitLatency   = 4
      else
        variable ReloadCount   = 7               ; ---- FIX THESE ----
        variable Latency       = 10  ; 16F
        variable ExitLatency   = 10
      endif
    I tried to change the values swapping between the 16f / 18f values as a test, but didn't seem to do anything.

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Again... your ANSELA line do not seems good...
    change it to
    ANSELA = %00001000


    and get rid of the DEFINE ADC_BITS 10 line

    Stil not for... replace the ADC reading by a ADC_VAL loop, see what happen.

    IMHO It has to work... or I still miss a crispy detail.
    Last edited by mister_e; - 29th August 2011 at 01:44.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    What happen if you Enable/Disable MIBAM within the IF/Then loop?
    Code:
    main:
        gosub do_adc 'get ADC reading
        pause 20
        
        ;T1CON.0 = 0 'disable mibam
        debug "ADC: ",dec4 adc_val,13,10
        pause 2
       ; T1CON.0 = 1 'enable mibam
        
        if adc_val > adc_thresh then 
            T1CON.0 = 1 'enable mibam
            FOR red = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT red
            red = 0
            
            FOR grn = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT grn
            grn = 0
            
            FOR BLU = 255 to 1 STEP -1
                    PAUSE Speed
            NEXT BLu
            blu = 0
            T1CON.0 = 0 'disable mibam
        endif  
    goto main
    Steve

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

  8. #8
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    I changed out the ANSELA line... not quite sure what is wrong with it.
    (and removed the DEFINE ADC_BITS 10 line as well)

    seemed correct looking at the datasheet.

    I am using AN3 as my analog input which is RA4, the readings I am getting
    with the debug output are correct (phototransistor reading light levels)

    also tried to enable/disable MIBAM within the loop, now the led doesn't trigger at all, with the enable/disable just around the debug statment, it did work once or twice before stopping... very strange.

    wondering if there is some other peripheral that needs to be disabled perhaps?
    these new pics have pretty much everything multiplexed except the kitchen sink it seems.

    Last edited by alesniak; - 29th August 2011 at 03:15.

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    alesniak,

    I am modifying MIBAM to work with the 16F1's.
    They did not exist when I wrote it.

    mister-E's modifications will not work, and I've deleted the attachment above.
    I don't need non-working copies of MIBAM floating around the internet, since I'm the one that people will complain to.

    I should have it by tomorrow.
    DT

  10. #10
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    fantastic! thank you Darrel! looking forward to it..

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Ok, here's the modification of MIBAM for use with 16F1's.
    It also works with 14-bit cores (12F, 16F) and 18F's.

    I've tested it on 16F1827, 16F1947, 16F877A and 18F4550.
    Sorry, I don't have a 12F1822.

    One problem I spent a lot of time trying to figure out ended up being caused by the statements ...

    T1CON.0 = 0 'disable mibam
    T1CON.0 = 1 'enable mibam


    I really thought that would work to stop interrupts from occuring during the DEBUG statements.
    But it turns out that 1 interrupt can still happen after you stop the timer.
    I have yet to understand how that happens, but it does.

    If you use these statements instead ...

    GIE = 0 'disable mibam
    GIE = 1 'enable mibam


    then no further interrupts occur to disturb the DEBUG's.
    They are actions of the chips themselves, not MIBAM.

    MIBAM seems stable at this point, but let me know if you have any problems.
    Attached Files Attached Files
    DT

  12. #12
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    fantastic! thank you again... going to give this a try this evening and report back. (day job and stuff..)

    question: is it going to be possible to use the hardware uart while mibam is running? eventually would like be able to receive serial commands, rgb data
    to control led color.

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Sure, the USART will work fine with MIBAM.
    Then you don't need to disable interrupts.

    I don't think you can have the POT connected, since the USART will use 2 pins and the LED's use 3 pins.
    There won't be an analog pin left. But since the serial data controls the LED's, you probably don't need the POT anymore.
    DT

  14. #14
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    update: finally got time to test the new MIBAM with the 12F1822 and works like a charm!! good stuff.
    So.... to make a more "proper" test I figured I'd whip up a little project to give a better demo, so did a quick and dirty pcb design threw in a few components, and presto a uber quick, interactive light module, (always wanted a interactive tabletop)

    here's a super rough video showing it all in action...



    I'm going to take a few days to clean up the code/pcb gerbers and post them
    here if anyone wants to build a fun blinky toy...

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Ooooo, very cool!
    That's the neatest use of MIBAM I've seen so far.

    Thanks for the video. I think my counter top needs a makeover. (if I wasn't renting)
    DT

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Yup. Very cool. Are you using the LEDs to sense changes, then flipping them to outputs, or using sensors?
    Regards,

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

  17. #17
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    the circuit is just a phototransistor and a resistor for the detector, I added a IR led next to it as well so it works in the dark. I sample the ADC every few ms and calculate the difference from previous/last sample, to get a delta value, and just trigger some flahsy lights if the delta exceeds the threshold value, which controls how sensitive the trigger is.

    I now have 1 pin left to do something with (I used it for debug output to see what my adc output was, thinking of using it to trigger adjacent modules perhaps, to create a cascading effect perhaps)

    funny didn't intend to build this earlier, but it's kinda fun, so I'll just keep going with it and see what I can get this tiny pic to do..

    and the 12f1822 is dirt cheap so perhaps I'll build a few dozen at least and
    see how it goes.

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Am I the only one that cannot see the video?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Doies it start or it says it's blocked due to copyright plah plah? Works here though (Firefox)
    Steve

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

  20. #20
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Hmm, curious. Now I am at home with a Vista/IE9 and it works OK.

    By the way very nice project alesniak.

    On my office XP-IE8 it was pure white. No youtube window no message. Nothing.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    I would try to re-install flashplayer and see what happen. Never messed that much with IE though...FireFox FTW
    Steve

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

  22. #22
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    hmm, must be a IE thing, I use firefox or chrome and the video seem to work fine.

    so sorry for the delay, I decided to make a about a hundred modules to build a
    interactive light table, so took me a few days to get the layout finished before I sent off a test pcb run, here's the pbp code if anyone is interested, feel free to make it better, cooler, etc.... I'm going to wait to post the pcb gerber files, I placed an order that should be here next few days, just to check that everything works as planned then I'll post the pcb files.. (don't really like posting stuff that I'm not 100% sure is working, untill I have the boards in hand)

    Code:
    '****************************************************************
    '     MIBAM TEST pic12F683 / pic12f1822                         *
    '****************************************************************
    
    #IF __PROCESSOR__ = "12F1822"
        #MSG "Compililng for 12F1822..."
        #CONFIG
           __config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF
           __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
        #ENDCONFIG
        OSCCON = %01110000        '8mhz
        TRISA  = %00011000        'setup inputs/outputs
        'ANSELA = %00010000        'RA4 = analog
        ANSELA = %00001000 
        CM1CON0 = 0               'disable comarators
        ADCON0 = %00001101        'Select AN3 enable ADC
        ADCON1 = %11010000        'Right Justify - Fosc/16 & 8mhz
        BTN var PORTA.3
    #ELSE
        #if __PROCESSOR__ = "12F683"
            #msg "Compiling for 12F683..."
            #CONFIG
                __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
            #ENDCONFIG
            OSCCON = %01110001       '8mhz
            TRISIO = %00011000       'setup inputs/outputs
            ANSEL  = %01011000       'RA4 = analog
            CMCON0 = %00000111       'disable comarators
            ADCON0 = %10001101       'Right Justify - Fosc/16 & 8mhz
            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 wsave1-3
            
            ' --- IF any of these three lines cause an error ?? ------------------------
            '       Comment them out to fix the problem ----
            ' -- Which variables are needed, depends on the Chip you are using -- 
            ;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
            ssave       VAR BYTE    BANK0   SYSTEM      ' location for STATUS register
            psave       VAR BYTE    BANK0   SYSTEM      ' location for PCLATH register
            ' --------------------------------------------------------------------------
            disable debug
            ;---------------------------------------------------------------------------
            BTN var GPIO.3
        #else
            #ERROR "Only 12F1822 & 12F683 are supported!"
        #endif
    #ENDIF
    
    DEFINE OSC 8              '8mhz
    
    DEFINE DEBUG_REG PORTA              'serial output to get ADC levels
    DEFINE DEBUG_BIT 5
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 0
    
    BAM_COUNT CON 3                     ; How many BAM Pins are used?
    INCLUDE "MIBAM.pbp"                 ; Mirror Image BAM module
    
    RED  VAR BYTE
    GRN  VAR BYTE
    BLU  VAR BYTE
    
    adc_val     var word                'adc value variable
    adc_last    var word                'previous adc value
    adc_thresh  var word                'adc trigger threshold variable
    adc_delta   var word                'change in adc/value
    Mode        var byte                'currently selected effect mode
    x           var byte                'just a byte
    
    ASM
    BAM_LIST  macro                     ; Define PIN's to use for BAM
         BAM_PIN (PORTA,0, BLU)         ;   and the associated Duty variables
         BAM_PIN (PORTA,1, RED)
         BAM_PIN (PORTA,2, GRN)
      endm
      BAM_INIT  BAM_LIST                ; Initialize the Pins
    ENDASM
    
    Speed CON 5         'led fade speed   
    adc_thresh = 20     'trigger threshold (adjust to change sensitivity)
    red = 0
    blu = 0
    grn = 0  
    MODE = 0
    
    
    '------------------------ MAIN PROGRAM LOOP ------------------------
    main:
    
        if btn = 0 then      'check mode button
            mode = mode + 1
            pause 400
            if btn = 0 then  'check to see if press/hold mode button (reset)
                pause 2000      'reset if modules get out of sync on modes.
                GIE = 1         'press mode button > 2.5 sec
                for x = 1 to 5
                    red = 50
                    pause 40
                    red = 0
                    pause 40
                next x
                GIE = 0
                red = 0
                mode = 0
            endif
            if mode > 4 then 
                mode = 0
            endif
        endif
        
    
        pause 30
        gosub do_adc           'get ADC reading
        gosub get_delta        'calculate delta since last reading
        'debug "ADC: ", dec4 adc_Val, "--> ",dec4 adc_last," D: ", dec3 adc_delta,13,10
         
        if adc_delta > adc_thresh then 'trigger effect if threshold exceded 
            GIE = 1
            select case mode
                case 0
                    gosub fadeR
                
                case 1 
                    gosub fadeG
                    
                case 2 
                    gosub fadeB
                    
                case 3
                    gosub sparkle
                    
                case 4
                    gosub flash
                    
            end select
            
            GIE = 0
            pause 30       
            gosub do_adc
            gosub get_delta
        endif 
        
    goto main
    
    '------------------------- SUBROUTINES ---------------------------------------
    
    Do_Adc:                 'sample ADC pin
        adc_last = adc_val
        pauseus 50
        ADCON0.1=1
        WHILE ADCON0.1 : WEND
        adc_val.highbyte = ADRESH
        adc_val.lowbyte = ADRESL
    return
        
    Get_Delta:
        if adc_last = adc_val then
            adc_delta = 0
            return
        else
            if adc_last > adc_val then
                adc_delta = adc_last - adc_val
            else
                adc_delta = adc_val - adc_last
            endif
        endif
    return
    
    
    '------------------- EFFECTS SECTION ------------------------
    
    fadeB:
        FOR BLU = 255 to 1 STEP -1
                PAUSE Speed
        NEXT BLu
        blu = 0
    return
    
    fadeG:
        FOR grn = 255 to 1 STEP -1
                PAUSE Speed
        NEXT grn
        grn = 0
    return
    
    fadeR:
        FOR red = 255 to 1 STEP -1
                PAUSE Speed
        NEXT red
        red = 0
    return
    
    
    sparkle:
        for x = 255 to 1 step -10
            red = x
            BLU = x
            pause 30
            red = 0
            BLU = 0
            pause 30
        next x
    return
    
    flash:
        red = 255
        grn = 255
        blu = 255
        pause 30
        red = 0
        grn = 0
        blu = 0
        pause 30
    return
    I've tested the code on both 12F683 and 12F1822, works great, don't forget to grab the latest version of MIBAM in this thread above! thanks again Darrel!.

    I'll post more pictures and video once I get the modules... stay tuned..

  23. #23
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    took a little while (day job gets in the way!) but here's what I ended up with..
    still have to finish my table assembly but the building blocks are nearly done
    I have hand assembled about 120 modules, they still need some wiring but
    all work like my original video above.

    front and back of the module, each is 1"x1" square


    a small pile of assembled modules, smt assembly really goes quickly, using a toaster to reflow the pcb's. only wish I had a pick & place machine.


    cnc'd some frosted acrylic to make individual tiles, which will become the tabletop..

  24. #24
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    here's a modified schematic, this doesn't reflect the pcb's in the pictures above
    it's been changed a little adding a diode for reverse polarity protection, and removing a few pins from the design which didn't work as I expected.





    that's it for now, I plan on posting a full buildlog once it's all done, I will post a link when it's done most likely a few weeks...

  25. #25
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    I wonder where can I get the solder paste for SMD. Can you post a link please?

    Very nice pcb and project in general. 5* for the whole!

    Ioannis

  26. #26
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    Dave
    Always wear safety glasses while programming.

  27. #27
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    WOW! Alesniak, thats awesom.

    Any possibility that others could order PCB's from the same source you used and not have to re-submit the pcb design?

    good work
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  28. #28
    Join Date
    Aug 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: MIBAM and 12F1822...

    here's the solder paste >>LINK<< I've used for a while... think I've had one tube for about 2 years... keep it in a fridge seems to work well..

    also use laser cut mylar pcb stencils to apply the paste, makes it really easy, and quick when you have 100+ pcb's....

    As for the pcb design, I didn't post the one I ran above since I wanted to change the design a bit, originally I was thinking of using my
    remaining pin, pin 5, to send a delayed pulse out to trigger adjacent modules, didn't really think it through, since if I had a dedicated input pin
    it would of worked, but being out of pins I ended up using the same pin I had the phototransistor input on, in doing so, when you chain a row
    of modules together when you trigger a module every other one instantly triggers instead of the delayed wave effect I was looking to get..

    I only did a run of 1x 155" sq panel from goldenphoenix, so I've used up all my modules, but I plan on doing a bigger batch since I've had people
    interested, I'll post some more details once I have my next design ready, it's going to be much much better (I hope) , with some cool effects that
    have adjacent modules sending out triggers to each other, making a fluid like effect possible...

    that said if anyone wants the files I used to get the above pcb's made send me a PM and I'll gladly send'em over to ya....






Members who have read this thread : 2

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