MIBAM and 12F1822...


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    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.

  2. #2
    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 02:15.

  3. #3
    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

  4. #4
    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..

  5. #5
    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

  6. #6
    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.

  7. #7
    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

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