I'm trying...
One MIBAM output (B0) going to a resistor then a LED which is then connected to VDD
Using a PIC16F628A with this code the LED remains on with no dimming.
What am I doing wrong?Code:@ __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF clear DEFINE OSC 8 INCLUDE "MIBAM.pbp" ' Mirror Image BAM module ;____[ 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 TRISB = 000000 PORTB = 0 LED1 VAR byte BAM_COUNT CON 1; How many BAM Pins are used? Speed CON 20; Smaller = Faster Brightness CON 200; Max DutyCycle ASM BAM_LIST macro ; Define PIN's to use for BAM BAM_PIN (PORTB,0, LED1) ; and the associated Duty variables endm BAM_INIT BAM_LIST ; Initialize the Pins ENDASM Main: FOR LED1 = 0 to Brightness -1 ' Ramp up 1 by 1 PAUSE Speed NEXT FOR LED1 = Brightness to 1 STEP -1 ' Ramp down 1 by 1 PAUSE Speed NEXT GOTO Main End
Mike




Bookmarks