Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
#include 16C84.INC
2
 
3
	org	0
4
 
5
	goto	Start
6
	;--------------------
7
	org	4
8
	;--------------------
9
 
10
Start:
11
	page1
12
	movlw 	00000000B	; inicializace citace a prescaleru
13
	movwf	TMR0
14
	movlw 	00000000B	; konfigurace preruseni
15
	movwf	INTCON
16
 
17
	page0			; inicializace portu
18
	movlw	0
19
	movwf	PORTA
20
	movwf	PORTB
21
 
22
	page1
23
	movlw	11110111B	; nastaveni portu na vstup nebo vystup
24
	movwf	PORTA		; 1=vstup 0=vystup
25
	movlw	11110001B
26
	movwf	PORTB
27
 
28
	bsf	TMR0, 7		; vypni pull-up na PORTB (OPTION registr)
29
 
30
	page0
31
 
32
	clrw			; vynulovani portu
33
	movwf	PORTA
34
	movwf	PORTB
35
 
36
	bsf	PORTA, 3	; Pull-Up na tlacitka
37
 
38
	bcf	PORTB, 1	; zhasnuti LED
39
	bcf	PORTB, 2
40
	bcf	PORTB, 3
41
 
42
MainLoop:
43
 
44
	movlw	10		; 10 ms
45
	movwf	DELAY1
46
	call	delay1ms
47
 
48
	bsf	PORTB, 3	; ON
49
 
50
	movlw	100		; 100 * 5us = 0,5 ms
51
 
52
	btfss	PORTA, 1	; Test TL1
53
	movlw	200		; 200 * 5us = 1 ms
54
 
55
	btfss	PORTB, 6	; Test TL2
56
	movlw	1		; 1 * 5us = 0,005 ms
57
 
58
	movwf	DELAY5
59
	call	delay5us	
60
 
61
	movlw	1		; 1 ms
62
	movwf	DELAY1
63
	call	delay1ms
64
 
65
	bcf	PORTB, 3	; OFF
66
 
67
	goto	MainLoop
68
 
69
	bcf	PORTB, 2	; zhasnuti LED
70
	bcf	PORTB, 1
71
 
72
	btfss	PORTA, 1	; Test TL1
73
	bsf	PORTB, 2	; rozsviceni LED2
74
 
75
	btfss	PORTB, 6	; Test TL2
76
	bsf	PORTB, 1	; rozsviceni LED2
77
 
78
	goto	MainLoop
79
	;---------------
80
 
81
 
82
#include SERVO.INC
83
#include DELAY.INC
84
 
85
	end