be80be
Well-Known Member
Shifting a HCF4015B with a pic16f628a for 7x 15 led Matrix
I'm trying to use a 4015 shift register to scroll 3 5x7 led blocks. What I have done right now is set up the 4015 with 8 leds to get it to scroll right I don't think I have the clock right
and this is the macro
and here is how I have it hooked up. I think I found what I did wrong
I left the part in red out lol should this work thanks for any help
Burt
I'm trying to use a 4015 shift register to scroll 3 5x7 led blocks. What I have done right now is set up the 4015 with 8 leds to get it to scroll right I don't think I have the clock right
Code:
list p=16f628A ; list directive to define processor
#include <p16F628A.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
cblock 0x20 ;Ram address
TX ;the 4015
CountSPI
endc
#define Data PORTA,0 ;hardware
#define Clock PORTA,1
org 0x0000 ;reset
goto Main
org 0x04 ;interrupt vector
goto Main ;no interrupts
include "HC40015.inc"
Main ;main program
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
banksel TRISA
movlw b'00011000' ;initializing porta
movwf TRISA
banksel PORTA
clrf PORTA
movlw 0xcb ;fill tx buffer
movwf TX
HC40015 TX, CountSPI
Loop
goto Loop ;hang out here
END ; directive 'end of program'
Code:
HC4015 macro Var,Var1
Local Loop ;label
movlw .8 ;eight bits to send
movwf Var1
Loop
rlf Var,f ;rotate Var to the left
btfss STATUS,C ;carry = 1 ?
bcf Data ;if not set line to 0
[COLOR="Red"]
btfsc STATUS,C ;is carry = 0 ?
bsf Data ;if not set, set data line to 1
[/COLOR]
bsf Clock ; generate 1 clock
nop
bcf Clock
decfsz Var1,f ;bits been sent ?
goto Loop ;if not repeat
endm
I left the part in red out lol should this work thanks for any help
Burt
Attachments
Last edited: