-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroboharkka.asm
95 lines (71 loc) · 1.88 KB
/
roboharkka.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
list P=PIC18F452, F=INHX32, C=160, N=0, ST=OFF, MM=OFF, R=DEC, X=ON
#include "P18F452.INC" ; Include header file
__CONFIG _CONFIG1H, _HS_OSC_1H ;HS oscillator
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_42_2L ;Reset
__CONFIG _CONFIG2H, _WDT_OFF_2H ;Watchdog timer disabled
__CONFIG _CONFIG3H, _CCP2MX_ON_3H ;CCP2 to RC1 (rather than to RB3)
__CONFIG _CONFIG4L, _LVP_OFF_4L ;RB5 enabled for I/O
CBLOCK 0x20 ; Declare variable addresses starting at 0x20
dataL
ENDC
org 0x0000 ; Program starts at 0x000
goto mainline
; ------------------------------------
; SET BAUD RATE TO COMMUNICATE WITH PC
; ------------------------------------
; Boot Baud Rate = 9600, No Parity, 1 Stop Bit
;
mainline
rcall Initial
rcall message
loop
rcall send ; send the char
goto loop
;;;;;;HARKKA;;;
Initial
BANKSEL SPBRG
movlw D'25'
movwf SPBRG
BANKSEL TXSTA
bsf TXSTA, BRGH
BANKSEL TXSTA
movlw B'00100100'
movwf TXSTA
BANKSEL RCSTA
movlw B'10010000'
movwf RCSTA
return
; -------------------------------------------------------------
; SEND CHARACTER IN W VIA RS232 AND WAIT UNTIL FINISHED SENDING
; -------------------------------------------------------------
;
;
; -------
; MESSAGE
; -------
;
message movlw '#'
call send
movlw '8'
call send
movlw 'P'
call send
movlw '7'
call send
movlw '5'
call send
movlw '0'
call send
movlw '0'
call send
movlw 0x0D ;CR
call send
return
send
movwf TXREG
BANKSEL PIR1
WaitTX
btfss PIR1, TXIF
goto WaitTX
return
END