swapan
Full Member level 4
Hi friends,
While making attempt to work on scrolling display project I am facing a peculiar problem of shift register 74HC164. As a test, I entered a message "WELCOME". When the message scrolls, the 9th column connected to Q0 of second shift register does not lit. I have tested the shift registers in the same hardware applying clock pulse and noticed that the output advances smoothly. Please see my code and schematic.
regards
swapan
While making attempt to work on scrolling display project I am facing a peculiar problem of shift register 74HC164. As a test, I entered a message "WELCOME". When the message scrolls, the 9th column connected to Q0 of second shift register does not lit. I have tested the shift registers in the same hardware applying clock pulse and noticed that the output advances smoothly. Please see my code and schematic.
regards
swapan
Code:
list p=16f72 ; list directive to define processor
#include <p16f72.inc> ; processor specific variable definitions
__CONFIG _CP_ALL & _WDTEN_OFF & _BODEN_ON & _PWRTEN_ON & _HS_OSC
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS (examples)
; example of using Uninitialized Data Section
cblock 0x20
jump_value
view_count
col_1
col_2
col_3
col_4
col_5
col_6
col_7
col_8
col_9
col_10
col_11
col_12
col_13
col_14
col_15
col_16
col_17
col_18
col_19
endc
;**********************************************************************
RESET_VECTOR CODE 0x0000 ; processor reset vector
goto start ; go to beginning of program
INT_VECTOR CODE 0x0004 ; interrupt vector location
MAIN_PROG CODE
start
bsf STATUS,RP0
movlw 00h
movwf TRISA
movlw 00h
movwf TRISB
movlw 00h
movwf TRISC
movlw 06h
movwf ADCON1
movlw b'10000111'
movwf OPTION_REG
bcf STATUS,RP0
;;;;;;;;;;;
Run_1:
clrf col_1 ; Column registers.
clrf col_2
clrf col_3
clrf col_4
clrf col_5
clrf col_6
clrf col_7
clrf col_8
clrf col_9
clrf col_10
clrf col_11
clrf col_12
clrf col_13
clrf col_14
clrf col_15
clrf col_16
clrf col_17
clrf col_18
clrf col_19
clrf jump_value
Run_2:
movlw d'100'
movwf view_count ; delay for viewing the columns.
call shift
incf jump_value,1
movf jump_value,0
call table
movwf col_1
xorlw 0FFh
btfsc status,z
goto Run_1
Run_3:
decfsz view_count,1
goto Run_4
goto Run_2
Run_4:
call scan
goto Run_3
table:
addwf 02h,1
retlw 00h
retlw 7Eh
retlw 01h
retlw 01h
retlw 7Eh
retlw 01h
retlw 01h
retlw 7Eh
retlw 00h
retlw 7Fh
retlw 49h
retlw 49h
retlw 41h
retlw 00h
retlw 7Fh
retlw 01h
retlw 01h
retlw 01h
retlw 00h
retlw 3Eh
retlw 41h
retlw 41h
retlw 41h
retlw 22h
retlw 00h
retlw 3Eh
retlw 41h
retlw 41h
retlw 41h
retlw 3Eh
retlw 00h
retlw 3Fh
retlw 40h
retlw 40h
retlw 3Fh
retlw 40h
retlw 40h
retlw 3Fh
retlw 00h
retlw 7Fh
retlw 49h
retlw 49h
retlw 41h
retlw 00h
retlw 00h
retlw 00h
retlw 00h
retlw 0FFh
shift:
movf col_18,0
movwf col_19 ;19
movf col_17,0
movwf col_18 ;18
movf col_16,0
movwf col_17 ;17
movf col_15,0
movwf col_16 ;16
movf col_14,0
movwf col_15 ;15
movf col_13,0
movwf col_14 ;14
movf col_12,0
movwf col_13 ;13
movf col_11,0
movwf col_12 ;12
movf col_10,0
movwf col_11 ;11
movf col_9,0
movwf col_10 ;10
movf col_8,0
movwf col_9 ;9
movf col_7,0
movwf col_8 ;8
movf col_6,0
movwf col_7 ;7
movf col_5,0
movwf col_6 ;6
movf col_4,0
movwf col_5 ;5
movf col_3,0
movwf col_4 ;4
movf col_2,0
movwf col_3 ;3
movf col_1,0
movwf col_2 ;2
return
scan:
bcf PORTA,0 ; Reset pulse to shift registers.
nop
nop
bsf PORTA,0
bsf PORTC,3 ; Pulse to input A B of 1st shift register.
bsf PORTA,1 ; Clock pulse.
nop
nop
bcf PORTA,1
bcf PORTC,3
movf col_1,0
movwf PORTB
call view_delay
movf col_2,0
movwf PORTB
call view_delay
movf col_3,0
movwf PORTB
call view_delay
movf col_4,0
movwf PORTB
call view_delay
movf col_5,0
movwf PORTB
call view_delay
movf col_6,0
movwf PORTB
call view_delay
movf col_7,0
movwf PORTB
call view_delay
movf col_8,0
movwf PORTB
call view_delay
movf col_19,0
movwf PORTB
call view_delay
movf col_10,0
movwf PORTB
call view_delay
movf col_11,0
movwf PORTB
call view_delay
movf col_12,0
movwf PORTB
call view_delay
movf col_13,0
movwf PORTB
call view_delay
movf col_14,0
movwf PORTB
call view_delay
movf col_15,0
movwf PORTB
call view_delay
movf col_16,0
movwf PORTB
call view_delay
movf col_17,0
movwf PORTB
call view_delay
movf col_18,0
movwf PORTB
call view_delay
movf col_19,0
movwf PORTB
call view_delay
return
view_delay:
movlw d’100’
movwf view_count
decfsz view_count,1
goto $-1
clrf PORTB
bsf PORTA,1 ; Clock pulse
nop
nop
bcf PORTA,1
return
END ; directive 'end of program'