; program 10
list p=16f628, r=hex ; declare processor,
; specyfying the radix
#include p16f628.inc ; include register label
; definitions
config h'3f10' ; configuration
; information
; for selected processor
; 3f10 HVP (High Voltage Programming)
; 3f90 LVP (Low Voltage Programming)
#define czas .8
l1 equ h'20'
l2 equ h'21'
d0 equ b'00111111' ; digit 0 d1 equ b'00000110'
d2 equ b'01011011'
d3 equ b'01001111' d4 equ b'01100110' d5 equ b'01101101' d6 equ b'01111101' d7 equ b'00000111' d8 equ b'01111111' d9 equ b'01101111'
diga equ b'01110111' ; digit A
digb equ b'01111100'
digc equ b'01011000'
digd equ
b'01011110'
dige equ b'01111001'
digf equ b'01110001'
dig7 equ b'10000000' ; decimal point
movlw h'07' ;07 -> w
movwf cmcon ; w->cmcon,
; comparators off
bsf status, rp0 ;bank 1
bcf pcon, oscf ;internal gen.32 kHz,
; Tcm=108μs
clrf trisa ;PORTA for output clrf trisb ;PORTB for output
bcf status, rp0 ;bank 0
clrf porta ; clear PORTA output latches clrf portb ;initializes PORTB
bcf porta, 6 ;zgas LED
bcf porta, 2 ;LED 2 off bsf porta, 0 ; LED 0 on
bsf porta, 7 ; LED 7 on
bcf porta, 5 ; LED 5 off
bcf porta, 3 ; LED 3 off
bcf porta, 1 ; LED 1 off nop
movlw d0
movwf portb call przerwa
movlw d1
movwf portb
call przerwa
movlw d2
movwf portb
call przerwa
movlw d3
movwf portb
call przerwa
movlw d4
movwf portb
call przerwa
movlw d5
movwf portb
call przerwa
movlw d6
movwf portb
call przerwa
movlw d7
movwf portb
call przerwa movlw d8
movwf portb
call przerwa
movlw d9
movwf portb
call przerwa
movlw diga
movwf portb
call przerwa
movlw digb
movwf portb
call przerwa
movlw digc
movwf portb
call przerwa
movlw digd
movwf portb
call przerwa
movlw dige
movwf portb
call przerwa
movlw digf
movwf portb
call przerwa movlw dig7
movwf portb
call przerwa
goto $ ; go to self
; loop here forever
przerwa
movlw czas movwf l1 clrf l2
spr nop
decfsz l2,f goto spr decfsz l1,f goto spr
return end
Related posts:
The Current Situation and Perspectives on the Use of Geothermal Energy for Electricity Generation:Ge...
Transformers:Basics
AC Power Systems:Utility AC Power System Architecture.
Thermal Stress of 10-MW Wind Power Converter Under Normal Operation:Stress of Converter Imposed by G...
Power quality and electromagnetic compatibility:Common problems
Transformers:Transformer Fundamentals
BIOMASS-BASED POWER GENERATION:TYPES OF BIOMASS
Grounding Practices:Establishing an Earth Ground.
Power Factor and Dissipation Factor Testing Methods:PF and DF Test Methods General
Transformers:Losses
GEOTHERMAL POWER:EXPLOITING THE MAGMA AND LOCATION OF GEOTHERMAL RESOURCES
POWER FROM WASTE:WASTE PLANT EMISSIONS
Multilevel Converters for Step-Up-Transformer-Less Direct Integration of Renewable Generation Units ...
Principles of electrical safety:Precautions against explosions
A Review of Interconnection Rules for Large-Scale Renewable Power Generation:Conclusions