biswajitdas49
Member level 3
- Joined
- May 17, 2012
- Messages
- 55
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- WEST BENGAL,INDIA
- Activity points
- 1,726
somebody please help me!I make a code for 8x8 dot matrix display scrolling data in pic16f1936.Now all the code running very well but I don't understand the logic how to scroll it,because my uC is 8 bit and I want to scroll two 8 bit data as a single 16bit.so somebody have any idea how to rotate left or right the column data.
here is my code===
and here is the proteus simulator working image===
here is my code===
Code:
;******************************************************************************
; This file is a basic code template for code generation on the *
; PIC16F1936. This file contains the basic code building blocks to build *
; upon. *
; *
; Refer to the MPASM User's Guide for additional information on *
; features of the assembler. *
; *
; Refer to the respective data sheet for additional *
; information on the instruction set. *
; *
;******************************************************************************
; *
; Filename: xxx.asm *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
; *
;******************************************************************************
; *
; Files Required: P16F1936.INC *
; *
;******************************************************************************
; *
; Notes: *
; *
;******************************************************************************
; *
; Revision History: *
; *
;******************************************************************************
list p=16f1936 ; list directive to define processor
#include <p16f1936.inc> ; processor specific variable definitions
;------------------------------------------------------------------------------
;
; CONFIGURATION WORD SETUP
;
; The 'CONFIG' directive is used to embed the configuration word within the
; .asm file. The lables following the directive are located in the respective
; .inc file. See the data sheet for additional information on configuration
; word settings.
;
;------------------------------------------------------------------------------
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_ON & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _VCAPEN_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF
;------------------------------------------------------------------------------
; VARIABLE DEFINITIONS
;
; Available Data Memory divided into Bank 0-15. Each Bank may contain
; Special Function Registers, General Purpose Registers, and Access RAM
;
;------------------------------------------------------------------------------
#DEFINE DATA_PIN PORTA,0
#DEFINE SHCP_PIN PORTA,1
#DEFINE STCP_PIN PORTA,2
CBLOCK 0x20 ; Define GPR variable register locations
COL_BIT_COUNTER
COLUMN_DATA
COLUMN_DATA_A ; User variables allocated contiguously
COLUMN_DATA_B
ROW_BIT_COUNTER ;
TABLE_COUNTER
CounterB
CounterA ;
CounterC
ENDC
PCL EQU .02 ; Sample user registers
SAMPLE2 EQU 0x7E ;
SAMPLE3 EQU 0x7F ;
;------------------------------------------------------------------------------
; EEPROM INITIALIZATION
;
; The 16F1936 has 256 bytes of non-volatile EEPROM, starting at address 0xF000
;
;------------------------------------------------------------------------------
DATAEE ORG 0xF000
DE "MCHP" ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
ORG 0x0000 ; processor reset vector
PAGESEL START
GOTO START ; When using debug header, first inst.
; may be passed over by ICD2.
;------------------------------------------------------------------------------
; INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------
ORG 0x0004
;------------------------------------------------------------------------------
; USER INTERRUPT SERVICE ROUTINE GOES HERE
;------------------------------------------------------------------------------
; Note the 16F1936 family automatically handles context restoration for
; W, STATUS, BSR, FSR, and PCLATH where previous templates for 16F families
; required manual restoration
BANKSEL INTCON
BCF INTCON,GIE
BCF INTCON,PEIE
BANKSEL PIE1
BCF PIE1,TMR2IE ; ENABLE PERIPHERAL INTERRUPTS
BANKSEL PIR1
BCF PIR1,TMR2IF
OUT_ISR
BANKSEL PIE1
BSF PIE1,TMR2IE ; ENABLE PERIPHERAL INTERRUPTS
BANKSEL INTCON
BSF INTCON,PEIE
RETFIE ; return from interrupt
;------------------------------------------------------------------------------
; MAIN PROGRAM
;------------------------------------------------------------------------------
START
;------------------------------------------------------------------------------
; PLACE USER PROGRAM HERE
;------------------------------------------------------------------------------
CALL Initialisation
CALL DATA_TRANSFER
GOTO $-1
Initialisation
BANKSEL OSCCON
MOVLW B'01111010'
MOVWF OSCCON ;Fosc 16MHz
BANKSEL PORTA
CLRF PORTA
; BANKSEL LATA
; CLRF LATA
BANKSEL ANSELA
CLRF ANSELA
BANKSEL TRISA
CLRF TRISA
BANKSEL LATB
CLRF LATB
BANKSEL PORTB
MOVLW B'00000000'
MOVWF PORTB
BANKSEL ANSELB
CLRF ANSELB
BANKSEL TRISB
CLRF TRISB
BANKSEL COL_BIT_COUNTER
MOVLW B'00000001'
MOVWF COL_BIT_COUNTER ;
BANKSEL COLUMN_DATA
CLRF COLUMN_DATA
BANKSEL COLUMN_DATA_A
CLRF COLUMN_DATA_A
BANKSEL COLUMN_DATA_B
CLRF COLUMN_DATA_B
BANKSEL ROW_BIT_COUNTER
MOVLW B'00000001'
MOVWF ROW_BIT_COUNTER
BANKSEL TABLE_COUNTER
CLRF TABLE_COUNTER
RETURN
DATA_TRANSFER
CALL DATA_B
CALL DATA_A
CALL ROW_CHANGE
BANKSEL TABLE_COUNTER
MOVF TABLE_COUNTER,W
SUBLW .7
BTFSS STATUS,Z
GOTO INCR_TABLE_COUNTER
BANKSEL TABLE_COUNTER
CLRF TABLE_COUNTER
RETURN
INCR_TABLE_COUNTER
BANKSEL TABLE_COUNTER
INCF TABLE_COUNTER,F
RETURN
DATA_A
BANKSEL TABLE_COUNTER
MOVF TABLE_COUNTER,W
PAGESEL TABLE_A
CALL TABLE_A
BANKSEL COLUMN_DATA
MOVWF COLUMN_DATA
; RRF COLUMN_DATA
CALL DATA_TRANSFER_ROUTINE
RETURN
TABLE_A
ADDWF PCL,F
RETLW B'01111110'
RETLW B'10000001'
RETLW B'10000001'
RETLW B'10000001'
RETLW B'11111111'
RETLW B'10000001'
RETLW B'10000001'
RETLW B'10000001'
DATA_B
BANKSEL TABLE_COUNTER
MOVF TABLE_COUNTER,W
PAGESEL TABLE_B
CALL TABLE_B
BANKSEL COLUMN_DATA
MOVWF COLUMN_DATA
; RRF COLUMN_DATA
CALL DATA_TRANSFER_ROUTINE
RETURN
TABLE_B
ADDWF PCL,F ;THIS TABLE IS FOR TRIANGULAR WAVE
RETLW B'11111110'
RETLW B'10000001'
RETLW B'10000001'
RETLW B'11111110'
RETLW B'11111110'
RETLW B'10000001'
RETLW B'10000001'
RETLW B'11111110'
ROW_CHANGE
BANKSEL TABLE_COUNTER
MOVF TABLE_COUNTER,W
PAGESEL TABLE_ROW
CALL TABLE_ROW
BANKSEL PORTB
MOVWF PORTB
CALL DELAY
BANKSEL PORTB
MOVLW B'11111111'
MOVWF PORTB
RETURN
TABLE_ROW
ADDWF PCL,F ;THIS TABLE IS FOR TRIANGULAR WAVE
RETLW B'11111110'
RETLW B'11111101'
RETLW B'11111011'
RETLW B'11110111'
RETLW B'11101111'
RETLW B'11011111'
RETLW B'10111111'
RETLW B'01111111'
DATA_TRANSFER_ROUTINE
BANKSEL COLUMN_DATA
BTFSC COLUMN_DATA,7
GOTO SET_DATAPIN
GOTO CLEAR_DATAPIN
SET_DATAPIN ;SET PORTA,0 AS HIGH
BANKSEL PORTA
BSF DATA_PIN
BSF SHCP_PIN
NOP
NOP
BCF SHCP_PIN
BANKSEL COL_BIT_COUNTER
BTFSS COL_BIT_COUNTER,7
GOTO ROTATE_BIT_COUNTER
GOTO SET_STCP_PIN
CLEAR_DATAPIN ;;SET PORTA,0 AS LOW
BANKSEL PORTA
BCF DATA_PIN
BSF SHCP_PIN
NOP
NOP
BCF SHCP_PIN
BANKSEL COL_BIT_COUNTER
BTFSS COL_BIT_COUNTER,7
GOTO ROTATE_BIT_COUNTER
GOTO SET_STCP_PIN
ROTATE_BIT_COUNTER
BANKSEL COLUMN_DATA
RLF COLUMN_DATA,F
BANKSEL COL_BIT_COUNTER
RLF COL_BIT_COUNTER,F
GOTO DATA_TRANSFER_ROUTINE
SET_STCP_PIN
BSF STCP_PIN
NOP
NOP
BCF STCP_PIN
BANKSEL COL_BIT_COUNTER
MOVLW B'00000001'
MOVWF COL_BIT_COUNTER
; BANKSEL COLUMN_DATA
; CLRF COLUMN_DATA
RETURN
DELAY
movlw D'23'
movwf CounterA
loop
decfsz CounterA,1
goto loop
retlw .0
; GOTO $
END
and here is the proteus simulator working image===