і
ИЗМЕРЕНИЯ
I
retlw d'163'
roovlw b'00000101
re tiw d' 165'
roovwf ADCONO
retlw d' 167'
retlw d'168'
; main cycle
retlw d'170'
retlw d' 172'
mainjc:
retlw d' 174 *
clrwdt
retlw d' 176'
decfsz CT , 1
retlw d'178'
goto main c
retlw d'180'
; waiting 1 ms
retlw d' 182'
roovlw OxOA
retlw d'184'
subwf L2 , 0
retlw d'186'
roovlw 0x03
retlw d' 188'
btfsc STATUS, Z
retlw d' 189'
roovlw 0x02
retlw d* 191'
retlw d'193'
decf X , 1
retlw d'195'
btfsc STATUS, Z
retlw d' 197'
roovwf X
retlw d'199'
retlw d'201'
roovf X , 0
retlw d'203'
roovwf troop
retlw d'205'
retlw d'208'
decfsz tronp , 1
retlw d'210'
goto minus 1
retlw d'212'
; — x
retlw d*214'
roovf L0 , 0
retlw d'216’
call PORT_A
retlw d'218'
roovwf A
retlw d'220'
retlw d'222*
roovf L0 , 0
retlw d’224'
call PORT_C
retlw d'226'
roovwf C__
retlw d'229'
retlw d'231'
bsf C_ , 5
retlw d'233'
retlw d'235'
goto thats_all
retlw d'237'
retlw d'240*
minus 1:
retlw d'242'
decfsz tronp , 1
retlw d'244'
goto minus 2
retlw d'246'
; -X-
retlw d'2481
roovf Ll , 0
retlw d’251'
call PORT_A
retlw d'253'
roovwf A_
retlw d'255' ;224 (224-32=192)
; init
roovf Ll , 0
call PORT_C
roovwf C
Start:
clrf INTCCJN
clrf PORTA
bsf A_ , 0
goto thats all
clrf PORTC
minus 2:
clrf C
clrf A
; x—
movlw 0x01
roovf L2 , 0
roovwf X
call PORT_A
movlw 0x07 ;Set RA<0> to
movwf CMCON /digital I/O
movwf A_
roovf L2 , 0
bsf STATUS,RP0 ;Bank 1
call PORT_C
roovwf C
clrf OPTION REG
bsf C
, 2
movlw b'11000010';Oxff /Set
RA<all> as inputs
roovwf TRISA
clrf WPUA
roovlw b'11000000’
; 1 - in ; 0
- out
roovwf TRISC ; set RC<1
,
4> as
outputs others - inputs
; init adc
movlw b'01100000'
roovwf ADCON1
; select Tosc = 1/
64 (3,2
mkc)
movlw b'00000010*
roovwf ANSEL ; select ain
channel (2,5,7)
bcf STATUS,RP0 /Bank 0
thats__all :
roovf A_ , 0
roovwf PORTA
roovf C_ , 0
roovwf PORTC
decfsz CTI , 1
goto main_c
; 100 ms left
roovf ADRESH , 0
roovwf troop
bsf ADCONO , 1
; <27 -> LO
movlw d'18'
subwf troop , 1
btfsc STATUS , C
goto next_l
; LO
movlw OxOA
roovwf L2
roovlw OxOB
roovwf L1
roovlw 0x00
roovwf L0
goto main_c
next_l :
; >192 -> HI ; 181-27 « 154
movlw d'207'
subwf troop / 0
btfss STATUS , C
goto next_2
; HI
hi_;
roovlw OxOA
roovwf L2
roovlw OxOC
roovwf Ll
roovlw OxOD
roovwf L0
goto aain_c
next 2 :
roovf troop , 0
call calc_P2x
roovwf troop
addlw 0x00
rrf tenp , 0
addlw 0x00
btfsc PORTA , 3
addwf tenp , 1
btfsc STATUS , C
goto hi_
clrf L2
L2_:
roovlw 0x64
subwf troop , 1
btfsc STATUS , C
incf L2 , 1
btfsc STATUS , C
goto L2_
addwf tenp , 1
clrf Ll
Ll_:
movlw OxOA
subwf troop , 1
btfsc STATUS , C
incf Ll ,1
btfsc STATUS , C
goto Ll_
addwf troop , 1
clrf L0
L0_:
roovlw 0x01
subwf troop , 1
btfsc.STATUS , C
incf L0 , 1
btfsc STATUS , C
goto L0_
movlw OxOA
roovf L2 , 1
btfsc STATUS , Z
roovwf L2
goto main_c
END
Программа прошивки - на сайті
нашего журнала
(файл DM2Jlp):
;
^
в разделе “Программы".
Vy
32
[
I Родиолюбитель - 06/2С
предыдущая страница 32 Радиолюбитель 2005-06 читать онлайн следующая страница 34 Радиолюбитель 2005-06 читать онлайн Домой Выключить/включить текст