目次PIC回路集サインボード


サインボード プログラムソースリスト

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
;********************************************************
;
;             The signboard control processing
;
;                                 Author : Seiichi Inoue
;********************************************************

        list            p=pic16f84a
        include         p16f84a.inc
       __config _hs_osc & _wdt_off & _pwrte_on & _cp_off

;****************  Label Definition  ********************
lpcnt   equ     0c              ;Screen loop counter adr
scrnidx equ     0d              ;Screen data index adr
w_save  equ     0e              ;W register save adr
s_save  equ     0f              ;STATUS reg save adr
scrnhd  equ     10              ;Screen table head adr
tm_cnt  equ     20              ;Time adjust counter adr
e_adr   equ     21              ;EEPROM data adr
e_check equ     22              ;EEPROM end check cnt adr
s_loop  equ     23              ;Screen data loop cnt adr
s_index equ     24              ;Screen table index adr
s_work  equ     25              ;Screen data work area

;************************
;*     Time adjust      *
;************************
;This data decides a scroll speed. Basic rate is 26msec.
tm_adj  equ     0c              ;Time adjust(26msec x 12)


;************************
;*   EEPROM data size   *
;************************
;If the data size is 30 bytes, then simply set d'30'.
e_size  equ    d'32'            ;EEPROM data size

;***************  EEPROM Data Definition  ***************
        org     h'2100'
        de      b'11111111'
        de      b'11111111'
        de      b'11100111'
        de      b'11000011'
        de      b'10000001'
        de      b'10000001'
        de      b'11000011'
        de      b'11100111'
        de      b'11111111'
        de      b'11111111'
        de      b'01111110'
        de      b'00000000'
        de      b'01111110'
        de      b'11111111'
        de      b'11110111'
        de      b'00000111'
        de      b'11110111'
        de      b'00000111'
        de      b'11111111'
        de      b'00000111'
        de      b'01110111'
        de      b'00000111'
        de      b'11111111'
        de      b'00000111'
        de      b'01111111'
        de      b'00000111'
        de      b'11111111'
        de      b'00000111'
        de      b'01010111'
        de      b'01000111'
        de      b'11111111'
        de      b'11111111'

;****************  Program Start  ***********************
        org     0               ;Reset Vector
        goto    init
        org     4               ;Interrupt Vector
        goto    int

;****************  Initial Process  *********************
        org     5
init    bsf     status,rp0      ;Change to Bank1
        clrf    trisa           ;Set PORTA to Output mode
        clrf    trisb           ;Set PORTB to Output mode
        movlw   h'07'           ;TOCS=0,PSA=0,PS2/1/0=111
        movwf   option_reg      ;Set timer condition
        bcf     status,rp0      ;Change to Bank0
        movlw   h'00'           ;Set timer value
        movwf   tmr0            ;TMR0 = 0 (255 counts)
        movlw   tm_adj          ;Set time adjust value
        movwf   tm_cnt          ;Save time adjust
        clrf    e_adr           ;Clear EEPROM data adr
        movlw   e_size          ;Set EEPROM data size
        movwf   e_check         ;Save EEPROM end check
        movlw   h'a0'           ;GIE=1,TOIE=1
        movwf   intcon          ;Interruption enable

;**************  Screen Load Process  *******************
screen  bsf     intcon,gie      ;Interrupt enable
        movlw   d'16'           ;Set loop count
        movwf   lpcnt           ;Save loop count
        movlw   h'0f'           ;Set screen index
        movwf   scrnidx         ;Save index
        bcf     intcon,gie      ;Interrupt disable
scrnlp  movlw   h'ff'           ;Set LED OFF data
        movwf   portb           ;Output Data
        movf    scrnidx,w       ;Set Position
        movwf   porta           ;Output Position
        movlw   scrnhd          ;Set Table head address
        addwf   scrnidx,w       ;Head + Index
        movwf   fsr             ;Set Table address
        movf    indf,w          ;Read Data
        movwf   portb           ;Output Data
        decf    scrnidx,f       ;Index - 1
        decfsz  lpcnt,f         ;Loop end ?
        goto    scrnlp          ;No. Next line
        goto    screen          ;Yes. Next screen

;************  Begin Interruption Process  **************
int     movwf   w_save          ;Save W register
        movf    status,w        ;Read STATUS reg
        movwf   s_save          ;Save STATUS reg
        btfsc   intcon,t0if     ;Time out interruption ?
        goto    timer_int       ;Jump to Timer process
        goto    init            ;Reset(Illegal interrupt)

;************  END of Interruption Process **************
int_end movf    s_save,w        ;Read saved STATUS reg
        movwf   status          ;Recover STATUS reg
        swapf   w_save,f        ;Read saved W register
        swapf   w_save,w        ;Recover W register
        retfie        
        
;***********  Time-out interruption Process  ************
timer_int
        bcf     intcon,t0if     ;Clear timer int flag
        movlw   h'00'           ;Set timer value
        movwf   tmr0            ;TMR0 = 0 (255 counts)
        decfsz  tm_cnt,f        ;Time over ?
        goto    int_end         ;No. Retry
        movlw   tm_adj          ;Set time adjust value
        movwf   tm_cnt          ;Save time adjust

;************  Screen data shift Process  ***************
        movlw   d'15'           ;Set loop count
        movwf   s_loop          ;Save loop count
        movlw   scrnhd          ;Set screen head adr
        movwf   s_index         ;Set screen adr
loop    incf    s_index,w       ;Inclement index
        movwf   fsr             ;Set read addres
        movf    indf,w          ;Read data
        movwf   s_work          ;Save data
        movf    s_index,w       ;Read index
        movwf   fsr             ;Set write address
        movf    s_work,w        ;Recover data
        movwf   indf            ;Write data
        incf    s_index,f       ;Inclement index
        decfsz  s_loop,f        ;All shifted ?
        goto    loop            ;No. Continue.

;**************  New data write Process  ****************
        movf    s_index,w       ;Read index
        movwf   fsr             ;Set write address
        movf    e_adr,w         ;Read EEPROM address
        movwf   eeadr           ;Set EEPROM address
        bsf     status,rp0      ;Change to Bank1
        bsf     eecon1,rd       ;Start EEPROM reading
        bcf     status,rp0      ;Change to Bank0
        movf    eedata,w        ;Read EEPROM data
        movwf   indf            ;Write new data
        incf    e_adr,f         ;Inclement data address
        decfsz  e_check,f       ;End of EEPROM data ?
        goto    int_end         ;No. Return
        clrf    e_adr           ;Clear EEPROM data adr
        movlw   e_size          ;Set EEPROM data size
        movwf   e_check         ;Save EEPROM end check
        goto    int_end         ;Return

;********************************************************
;          END of signboard control processing
;********************************************************

        end



サインボード プログラムアッセンブルリスト

MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 ;********************************************************
                      00002 ;
                      00003 ;             The signboard control processing
                      00004 ;
                      00005 ;                                 Author : Seiichi Inoue
                      00006 ;********************************************************
                      00007 
                      00008         LIST            P=PIC16F84A
                      00009         INCLUDE         P16F84A.INC
                      00001         LIST
                      00002 ; P16F84A.INC  Standard Header File, Version 2.00(modify)
                      00134         LIST
2007   3FF2           00010        __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
                      00011 
                      00012 ;****************  Label Definition  ********************
  0000000C            00013 LPCNT   EQU     0C              ;Screen loop counter adr
  0000000D            00014 SCRNIDX EQU     0D              ;Screen data index adr
  0000000E            00015 W_SAVE  EQU     0E              ;W register save adr
  0000000F            00016 S_SAVE  EQU     0F              ;STATUS reg save adr
  00000010            00017 SCRNHD  EQU     10              ;Screen table head adr
  00000020            00018 TM_CNT  EQU     20              ;Time adjust counter adr
  00000021            00019 E_ADR   EQU     21              ;EEPROM data adr
  00000022            00020 E_CHECK EQU     22              ;EEPROM end check cnt adr
  00000023            00021 S_LOOP  EQU     23              ;Screen data loop cnt adr
  00000024            00022 S_INDEX EQU     24              ;Screen table index adr
  00000025            00023 S_WORK  EQU     25              ;Screen data work area
                      00024 
                      00025 ;************************
                      00026 ;*     Time adjust      *
                      00027 ;************************
                      00028 ;This data decides a scroll speed. Basic rate is 26msec.
  0000000C            00029 TM_ADJ  EQU     0C              ;Time adjust(26msec x 12)
                      00030 
                      00031 
                      00032 ;************************
                      00033 ;*   EEPROM data size   *
                      00034 ;************************
                      00035 ;If the data size is 30 bytes, then simply set d'30'.
  00000020            00036 E_SIZE  EQU    D'32'            ;EEPROM data size
                      00037 
                      00038 ;***************  EEPROM Data Definition  ***************
2100                  00039         ORG     H'2100'
2100   00FF           00040         DE      B'11111111'
2101   00FF           00041         DE      B'11111111'
2102   00E7           00042         DE      B'11100111'
2103   00C3           00043         DE      B'11000011'
2104   0081           00044         DE      B'10000001'
2105   0081           00045         DE      B'10000001'
2106   00C3           00046         DE      B'11000011'
2107   00E7           00047         DE      B'11100111'
2108   00FF           00048         DE      B'11111111'
2109   00FF           00049         DE      B'11111111'
210A   007E           00050         DE      B'01111110'
MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

210B   0000           00051         DE      B'00000000'
210C   007E           00052         DE      B'01111110'
210D   00FF           00053         DE      B'11111111'
210E   00F7           00054         DE      B'11110111'
210F   0007           00055         DE      B'00000111'
2110   00F7           00056         DE      B'11110111'
2111   0007           00057         DE      B'00000111'
2112   00FF           00058         DE      B'11111111'
2113   0007           00059         DE      B'00000111'
2114   0077           00060         DE      B'01110111'
2115   0007           00061         DE      B'00000111'
2116   00FF           00062         DE      B'11111111'
2117   0007           00063         DE      B'00000111'
2118   007F           00064         DE      B'01111111'
2119   0007           00065         DE      B'00000111'
211A   00FF           00066         DE      B'11111111'
211B   0007           00067         DE      B'00000111'
211C   0057           00068         DE      B'01010111'
211D   0047           00069         DE      B'01000111'
211E   00FF           00070         DE      B'11111111'
211F   00FF           00071         DE      B'11111111'
                      00072 
                      00073 ;****************  Program Start  ***********************
0000                  00074         ORG     0               ;Reset Vector
0000   2805           00075         GOTO    INIT
0004                  00076         ORG     4               ;Interrupt Vector
0004   2827           00077         GOTO    INT
                      00078 
                      00079 ;****************  Initial Process  *********************
0005                  00080         ORG     5
0005   1683           00081 INIT    BSF     STATUS,RP0      ;Change to Bank1
0006   0185           00082         CLRF    TRISA           ;Set PORTA to Output mode
0007   0186           00083         CLRF    TRISB           ;Set PORTB to Output mode
0008   3007           00084         MOVLW   H'07'           ;TOCS=0,PSA=0,PS2/1/0=111
0009   0081           00085         MOVWF   OPTION_REG      ;Set timer condition
000A   1283           00086         BCF     STATUS,RP0      ;Change to Bank0
000B   3000           00087         MOVLW   H'00'           ;Set timer value
000C   0081           00088         MOVWF   TMR0            ;TMR0 = 0 (255 counts)
000D   300C           00089         MOVLW   TM_ADJ          ;Set time adjust value
000E   00A0           00090         MOVWF   TM_CNT          ;Save time adjust
000F   01A1           00091         CLRF    E_ADR           ;Clear EEPROM data adr
0010   3020           00092         MOVLW   E_SIZE          ;Set EEPROM data size
0011   00A2           00093         MOVWF   E_CHECK         ;Save EEPROM end check
0012   30A0           00094         MOVLW   H'a0'           ;GIE=1,TOIE=1
0013   008B           00095         MOVWF   INTCON          ;Interruption enable
                      00096 
                      00097 ;**************  Screen Load Process  *******************
0014   178B           00098 SCREEN  BSF     INTCON,GIE      ;Interrupt enable
0015   3010           00099         MOVLW   D'16'           ;Set loop count
0016   008C           00100         MOVWF   LPCNT           ;Save loop count
0017   300F           00101         MOVLW   H'0f'           ;Set screen index
0018   008D           00102         MOVWF   SCRNIDX         ;Save index
0019   138B           00103         BCF     INTCON,GIE      ;Interrupt disable
MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

001A   30FF           00104 SCRNLP  MOVLW   H'ff'           ;Set LED OFF data
001B   0086           00105         MOVWF   PORTB           ;Output Data
001C   080D           00106         MOVF    SCRNIDX,W       ;Set Position
001D   0085           00107         MOVWF   PORTA           ;Output Position
001E   3010           00108         MOVLW   SCRNHD          ;Set Table head address
001F   070D           00109         ADDWF   SCRNIDX,W       ;Head + Index
0020   0084           00110         MOVWF   FSR             ;Set Table address
0021   0800           00111         MOVF    INDF,W          ;Read Data
0022   0086           00112         MOVWF   PORTB           ;Output Data
0023   038D           00113         DECF    SCRNIDX,F       ;Index - 1
0024   0B8C           00114         DECFSZ  LPCNT,F         ;Loop end ?
0025   281A           00115         GOTO    SCRNLP          ;No. Next line
0026   2814           00116         GOTO    SCREEN          ;Yes. Next screen
                      00117 
                      00118 ;************  Begin Interruption Process  **************
0027   008E           00119 INT     MOVWF   W_SAVE          ;Save W register
0028   0803           00120         MOVF    STATUS,W        ;Read STATUS reg
0029   008F           00121         MOVWF   S_SAVE          ;Save STATUS reg
002A   190B           00122         BTFSC   INTCON,T0IF     ;Time out interruption ?
002B   2832           00123         GOTO    TIMER_INT       ;Jump to Timer process
002C   2805           00124         GOTO    INIT            ;Reset(Illegal interrupt)
                      00125 
                      00126 ;************  END of Interruption Process **************
002D   080F           00127 INT_END MOVF    S_SAVE,W        ;Read saved STATUS reg
002E   0083           00128         MOVWF   STATUS          ;Recover STATUS reg
002F   0E8E           00129         SWAPF   W_SAVE,F        ;Read saved W register
0030   0E0E           00130         SWAPF   W_SAVE,W        ;Recover W register
0031   0009           00131         RETFIE        
                      00132         
                      00133 ;***********  Time-out interruption Process  ************
0032                  00134 TIMER_INT
0032   110B           00135         BCF     INTCON,T0IF     ;Clear timer int flag
0033   3000           00136         MOVLW   H'00'           ;Set timer value
0034   0081           00137         MOVWF   TMR0            ;TMR0 = 0 (255 counts)
0035   0BA0           00138         DECFSZ  TM_CNT,F        ;Time over ?
0036   282D           00139         GOTO    INT_END         ;No. Retry
0037   300C           00140         MOVLW   TM_ADJ          ;Set time adjust value
0038   00A0           00141         MOVWF   TM_CNT          ;Save time adjust
                      00142 
                      00143 ;************  Screen data shift Process  ***************
0039   300F           00144         MOVLW   D'15'           ;Set loop count
003A   00A3           00145         MOVWF   S_LOOP          ;Save loop count
003B   3010           00146         MOVLW   SCRNHD          ;Set screen head adr
003C   00A4           00147         MOVWF   S_INDEX         ;Set screen adr
003D   0A24           00148 LOOP    INCF    S_INDEX,W       ;Inclement index
003E   0084           00149         MOVWF   FSR             ;Set read addres
003F   0800           00150         MOVF    INDF,W          ;Read data
0040   00A5           00151         MOVWF   S_WORK          ;Save data
0041   0824           00152         MOVF    S_INDEX,W       ;Read index
0042   0084           00153         MOVWF   FSR             ;Set write address
0043   0825           00154         MOVF    S_WORK,W        ;Recover data
0044   0080           00155         MOVWF   INDF            ;Write data
0045   0AA4           00156         INCF    S_INDEX,F       ;Inclement index
MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0046   0BA3           00157         DECFSZ  S_LOOP,F        ;All shifted ?
0047   283D           00158         GOTO    LOOP            ;No. Continue.
                      00159 
                      00160 ;**************  New data write Process  ****************
0048   0824           00161         MOVF    S_INDEX,W       ;Read index
0049   0084           00162         MOVWF   FSR             ;Set write address
004A   0821           00163         MOVF    E_ADR,W         ;Read EEPROM address
004B   0089           00164         MOVWF   EEADR           ;Set EEPROM address
004C   1683           00165         BSF     STATUS,RP0      ;Change to Bank1
004D   1408           00166         BSF     EECON1,RD       ;Start EEPROM reading
004E   1283           00167         BCF     STATUS,RP0      ;Change to Bank0
004F   0808           00168         MOVF    EEDATA,W        ;Read EEPROM data
0050   0080           00169         MOVWF   INDF            ;Write new data
0051   0AA1           00170         INCF    E_ADR,F         ;Inclement data address
0052   0BA2           00171         DECFSZ  E_CHECK,F       ;End of EEPROM data ?
0053   282D           00172         GOTO    INT_END         ;No. Return
0054   01A1           00173         CLRF    E_ADR           ;Clear EEPROM data adr
0055   3020           00174         MOVLW   E_SIZE          ;Set EEPROM data size
0056   00A2           00175         MOVWF   E_CHECK         ;Save EEPROM end check
0057   282D           00176         GOTO    INT_END         ;Return
                      00177 
                      00178 ;********************************************************
                      00179 ;          END of signboard control processing
                      00180 ;********************************************************
                      00181 
                      00182         END
MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  5


SYMBOL TABLE
  LABEL                             VALUE 

C                                 00000000
DC                                00000001
EEADR                             00000009
EECON1                            00000008
EECON2                            00000009
EEDATA                            00000008
EEIE                              00000006
EEIF                              00000004
E_ADR                             00000021
E_CHECK                           00000022
E_SIZE                            00000020
F                                 00000001
FSR                               00000004
GIE                               00000007
INDF                              00000000
INIT                              00000005
INT                               00000027
INTCON                            0000000B
INTE                              00000004
INTEDG                            00000006
INTF                              00000001
INT_END                           0000002D
IRP                               00000007
LOOP                              0000003D
LPCNT                             0000000C
NOT_PD                            00000003
NOT_RBPU                          00000007
NOT_TO                            00000004
OPTION_REG                        00000001
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
PS0                               00000000
PS1                               00000001
PS2                               00000002
PSA                               00000003
RBIE                              00000003
RBIF                              00000000
RD                                00000000
RP0                               00000005
RP1                               00000006
SCREEN                            00000014
SCRNHD                            00000010
SCRNIDX                           0000000D
SCRNLP                            0000001A
STATUS                            00000003
S_INDEX                           00000024
S_LOOP                            00000023
S_SAVE                            0000000F
S_WORK                            00000025
T0CS                              00000005
T0IE                              00000005
MPASM 02.40 Released             SIGN.ASM   6-3-2000  17:01:23         PAGE  6


SYMBOL TABLE
  LABEL                             VALUE 

T0IF                              00000002
T0SE                              00000004
TIMER_INT                         00000032
TMR0                              00000001
TM_ADJ                            0000000C
TM_CNT                            00000020
TRISA                             00000005
TRISB                             00000006
W                                 00000000
WR                                00000001
WREN                              00000002
WRERR                             00000003
W_SAVE                            0000000E
Z                                 00000002
_CP_OFF                           00003FFF
_CP_ON                            0000000F
_HS_OSC                           00003FFE
_LP_OSC                           00003FFC
_PWRTE_OFF                        00003FFF
_PWRTE_ON                         00003FF7
_RC_OSC                           00003FFF
_WDT_OFF                          00003FFB
_WDT_ON                           00003FFF
_XT_OSC                           00003FFD
__16F84A                          00000001


MEMORY USAGE MAP ('X' = Used,  '-' = Unused)

0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : XXXXXXXXXXXXXXXX XXXXXXXX-------- ---------------- ----------------
2000 : -------X-------- ---------------- ---------------- ----------------
2100 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ---------------- ----------------

All other memory blocks unused.

Program Memory Words Used:    85
Program Memory Words Free:   939


Errors   :     0
Warnings :     0 reported,     0 suppressed
Messages :     0 reported,     0 suppressed



sign_source.zip
sign_hex.zip