![Pololu P-Star 25K50 Micro Скачать руководство пользователя страница 43](http://html1.mh-extra.com/html/pololu/p-star-25k50-micro/p-star-25k50-micro_user-manual_1574946043.webp)
If your P-Star has a PIC18F45K50, the code above will work as is, but you should change it
to include
p18f45k50.inc
instead of
p18f25k50.inc
.
13. To compile the code, open the “Run” menu and select “Build Main Project”.
14. The “Output” pane should show the build output from MPLAB X. One of the last lines of the
output should say “Loading code from” and have the full path to the HEX file produced during
compilation.
Where to find more information
For information about the instruction set, hardware peripherals, and registers on the PIC, see the
[http://www.microchip.com/PIC18F25K50]
datasheet.
For information about MPLAB X, you can find useful resources under the “Help” menu and in the
“docs” directory inside your MPLAB X installation.
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
#include <p18f25k50.inc>
org
0x2000
goto
start
org
0x2020
ledRedOn:
bcf
TRISC, 6
return
ledRedOff:
bsf
TRISC, 6
return
start:
bcf
LATC, 6
; Set up the red LED
; Enable Timer 0 as a 16-bit timer with 1:256 prescaler:
; since the instruction speed is 12 MHz, this overflows about
; every 1.4 seconds.
movlw
b'10000111'
movwf
T0CON
mainLoop:
movf
TMR0L, W
; Trigger an update of TMR0H
; Blink the red LED with a period of 1.4 s.
btfss
TMR0H, 7
rcall
ledRedOff
btfsc
TMR0H, 7
rcall
ledRedOn
goto
mainLoop
end
Pololu P-Star User’s Guide
© 2001–2019 Pololu Corporation
10. Compiling a program with MPLAB X and MPASM
Page 43 of 46