;********************************************************************** ; ; Filename: MultiLED.asm ; Date: 2008 Mar 13 ; File Version: 0 ; ; Author: JR7DUT ; Company: DUT Brewery ; ; ;********************************************************************** ; ; Files required: ; ; ; ;********************************************************************** ; ; Notes: Program for Full Color LED brightening ; Annode common type ; ; ; ; ;********************************************************************** list p=12f629 ; list directive to define processor #include ; processor specific variable definitions errorlevel -302 ; suppress message 302 from list file __CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT ;***** VARIABLE DEFINITIONS Steps EQU 021h ; for Slope steps Cyc1 EQU 022h ; Status1 count Cyc2 EQU 023h ; Status2 count Duty1 EQU 024h ; Duty1 set Duty2 EQU 025h ; Duty2 set Rep_outer EQU 026h ; for Interval adjust,outer loop Rep EQU 027h ; for Interval adjust LEDadd1 EQU 028h ; Port Indicator Status1 LEDadd2 EQU 029h ; Port Indicator Status2 ;********************************************************************** ORG 000h ; processor reset vector nop ; nop required for icd goto main ; go to beginning of program ORG 01ch ; LED on main clrf GPIO bsf STATUS,RP0 movlw 008h movwf TRISIO ; LED_on output bcf STATUS,RP0 ; Red GPIO5 Low ; Blue GPIO4 Low ; Green GPIO2 Low ; LED sequence ; 1 Blue-Green Blue,GPIO2/Green,GPIO4 movlw b'00100000' ; Keep Blue-Green movwf LEDadd1 movlw b'00100000' ; Keep Blue-Green movwf LEDadd2 call Change ; 2 White R-G-B Red,GPIO5 White movlw b'00100000' ; Beginning status movwf LEDadd1 movlw b'00000000' ; Increase Red movwf LEDadd2 call Change ; 3 Purple R-B movlw b'00000000' ; Beginning status movwf LEDadd1 movlw b'00000100' ; Decrease Green movwf LEDadd2 call Change ; 4 Red R movlw b'00000100' ; Beginning status movwf LEDadd1 movlw b'00010100' ; Decrease Blue movwf LEDadd2 call Change ; 5 Orange R-G movlw b'00010100' ; Beginning status movwf LEDadd1 movlw b'00010000' ; Increase Green movwf LEDadd2 call Change ; 6 Green G movlw b'00010000' ; Beginning status movwf LEDadd1 movlw b'00110000' ; Decrease Red movwf LEDadd2 call Change ; 7 Blue B movlw b'00110000' ; Beginning status movwf LEDadd1 movlw b'00100100' ; Decrease Green & Increase Blue movwf LEDadd2 call Change ; 8 Blue-Green B-G movlw b'00100100' ; Beginning status movwf LEDadd1 movlw b'00100000' ; Decrease Red movwf LEDadd2 call Change goto White ; Status change Change movlw 080h movwf Steps ; Set declining steps decf Steps,W ; Set Duty of single step Duty movwf Duty1 subwf Steps,W movwf Duty2 movlw 010h movwf Rep_outer ; Repetition times for interval adjust, Outer loop Louter movlw 0ffh movwf Rep ; Repetition times for interval adjust Linner movf Duty1,W movwf Cyc1 movf Duty2,W movwf Cyc2 movf LEDadd1,W ; LED Status1 in GPIO movwf GPIO LED1 decfsz Cyc1,F goto LED1 movf LEDadd2,W ; LED Status2 in GPIO movwf GPIO LED2 decfsz Cyc2,F goto LED2 decfsz Rep,F ; Rereat (Rep) times at the same duty goto Linner decfsz Rep_outer,F goto Louter decfsz Duty1,W ; Delightning (Duty_on Value in the W Reg) goto Duty return END