DEFINE OSC 20 OSCCON = 0 'SET SYSTEM CLOCK SWITCH BIT ;----- Configuration bits ------------------------------------------------ @Line1 = _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_ON @Line2 = _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _HS_OSC @ __CONFIG _CONFIG1, Line1 & Line2 @ __CONFIG _CONFIG2, _WRT_HALF & _BOR40V PORTA=0:PORTB=0:PORTC=0:PORTD=0:PORTE=0 TRISA=%00000000 'RA0:Analog input 0 'RA1:Analog input 1 'RA2:Analog input 2 'RA3:Analog input 3 'RA4:sdo 'RA5:Clock TRISB=%00000000 'RB0-RB3 Digital Inputs 'RB4, RB5: Menu and Sel button 'RB6,RB7: ICSP TRISC=%00000000 'RC0:Relay driver 0 'RC1:Relay driver 1 'RC2:Relay driver 2 'RC3:Relay driver 3 'RC4:E of LCD 'RC5:RS of LCD 'RC6:RS232 Tx USART 'RC7:RS232 Rx USART TRISD=%00000000 'RD0:LCD Data Bus 'RD1:LCD Data Bus 'RD2:LCD Data Bus 'RD3:LCD Data Bus 'RD4: 'RD5: 'RD6: 'RD7: TRISE=%00000000 'RE0:LOAD 'RE1:Sdi 'RE2:STRB OPTION_REG.0=1 'PSA0 PRESCALER SELECT 1:1 TO 1:256 OPTION_REG.1=1 'PSA1 OPTION_REG.2=1 'PSA2 OPTION_REG.3=0 'PRESCALER TO: 1->WDT, 0->TMR0 OPTION_REG.4=0 'T0SE SOURCE EDGE 1->H TO L, 0->L TO H OPTION_REG.5=0 'T0CS 1->FROM RA4, 0->FROM INT. CLOCK OPTION_REG.6=0 'INT EDGE SELECT 0->H TO L, 1->L TO H OPTION_REG.7=0 'PULL UP 1->DISABLE, 0->ENABLE WPUB = 0 ADCON0 = 0 ADCON1 = 0 ANSEL = 0 ANSELH = 0 Speed CON 20 ; Smaller = Faster Brightness CON 255 ; Max DutyCycle ;____[ 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 led1 VAR BYTE led2 VAR BYTE led3 VAR BYTE 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) endm BAM_INIT BAM_LIST ; Initialize the Pins ENDASM Main: FOR led1 = 0 to Brightness -1 ; Ramp up 1 by 1 PAUSE Speed NEXT led1 FOR led2 = 0 to Brightness -1 PAUSE Speed NEXT led2 FOR led3 = 0 to Brightness -1 PAUSE Speed NEXT led3 FOR led1 = Brightness to 1 STEP -1 ; Ramp down 1 by 1 PAUSE Speed NEXT led1 FOR led2 = Brightness to 1 STEP -1 PAUSE Speed NEXT led2 FOR led3 = Brightness to 1 STEP -1 PAUSE Speed NEXT led3 GOTO Main END