Mike - K8LH
Well-Known Member
I just finished restructuring A12-Fix3Color.asm so that it made more sense (to me) and son-of-a-gun if it doesn't resemble your flowchart (lol)...
This is a pretty novel approach that deserves closer study. Darn it... You're distracting me from a couple other projects I really should be working on (a CDP1802 single board computer and a microcontroller based German Enigma machine)...
Cheerful regards, Mike
<added>
insert "radix dec" at the top of program and fix the delay/repeat value (0..255).
This is a pretty novel approach that deserves closer study. Darn it... You're distracting me from a couple other projects I really should be working on (a CDP1802 single board computer and a microcontroller based German Enigma machine)...
Cheerful regards, Mike
Code:
list p=16F628A, st=off
#include <p16F628A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT & _LVP_OFF
errorlevel -302,-311,-202
cblock 0x20
Color1 ;
Color2 ;
Color3 ;
speed ;
endc
#define bank0 bcf STATUS,RP0
#define bank1 bsf STATUS,RP0
;==================================================================
;
rainbow macro c1,c2,c3 ; three 4-bit color values
movlw c1<<4 ; |00
movwf Color1 ; |00
movlw c2<<4 ; |00
movwf Color2 ; |00
movlw c3<<4 ; |00
movwf Color3 ; |00
call frame1 ; |00
endm
;==================================================================
;
display macro color,pattern
movf color,W ; color bits in b7..b4 |00
addlw pattern/256 ; add column b11..b8 bits |00
movwf PORTA ; |00
movlw pattern%256 ; the column b7..b0 bits |00
movwf PORTB ; |00
endm
;******************************************************************
; main init (reset vector) *
;******************************************************************
org 0x000
start
clrf STATUS ; bank 0 |00
movlw b'00000111' ; Set all ports as outputs |00
movwf CMCON ; Disable comparators |00
bank1 ; |01
clrf TRISA ; |01
clrf TRISB ; |01
bank0 ; |00
;******************************************************************
; main loop *
;******************************************************************
Sequence
call MegaColor ; ???? |00
goto Sequence ; |00
;
; each animation has 24 frames over 12 chan RGB for total of 24
; color bit resolution (producing vivid colors). refresh rate
; of 500 cycles to prevent flickering.
;
MegaColor
rainbow b'0001',b'0100',b'1000'
rainbow b'0001',b'0100',b'1000'
rainbow b'0001',b'0100',b'1000'
rainbow b'0001',b'1101',b'1001'
rainbow b'0101',b'0001',b'0101'
rainbow b'0001',b'0101',b'0001'
rainbow b'0001',b'0101',b'1001'
rainbow b'0001',b'0101',b'0100'
rainbow b'0001',b'0100',b'1000'
rainbow b'1001',b'1101',b'0100'
rainbow b'1000',b'1101',b'0001'
rainbow b'0001',b'1101',b'0100'
rainbow b'0100',b'1101',b'1000'
return ; |00
frame1
movlw 500 ; <-- this ain't gonna work... oops!
movwf speed ; |00
frloop
display Color1,b'111000001111'
display Color1,b'110000000111'
display Color1,b'100000000011'
display Color1,b'000000000001'
display Color3,b'000011111110'
display Color3,b'000001111100'
display Color3,b'000000111000'
display Color3,b'000000010000'
display Color2,b'111111100000'
display Color2,b'011111000000'
display Color2,b'001110000000'
display Color2,b'000100000000'
decfsz speed,F ; done? yes, skip, else |00
goto frloop ; branch (repeat frame) |00
return
;==================================================================
end
<added>
insert "radix dec" at the top of program and fix the delay/repeat value (0..255).
Code:
list p=16F628A, st=off
#include <p16F628A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT & _LVP_OFF
errorlevel -302,-311,-202
radix dec
Last edited: