PIC18, MPLAB X IDE, XC8, GPIO, BlinkLED
Did you have a look at the example codes for the MCU that is provided by TI for almost every processor?
The following examples show how to set up the clocks:
msp430fr59xx_cs_01.c Configure MCLK for 8MHz operation
msp430fr59xx_cs_02.c Configure MCLK for 16MHz operation
msp430fr59xx_cs_03.c Output 32768Hz crystal on XT1 and observe failsafe
msp430fr59xx_cs_04.c ACLK = XT1 = 32768Hz, SMCLK= XT2 = 8MHz, MCLK = DCO
msp430fr59xx_cs_05.c Using LFXT in bypass mode, failsafe operation shown
0. 참고 사항
- C:\ti\msp\MSP430Ware_3_80_04_05\examples\devices\MSP430FR5xx_6xx\MSP430FR5x8x_MSP430FR692x_MSP430FR6x7x_MSP430FR6x8x_Code_Examples\C
- http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/368560/1297094
- https://github.com/achopra6/MSP430FR6989/blob/master/timer.c
- http://www.ti.com/lit/ds/symlink/msp430fr6989.pdf
- http://www.ti.com/lit/ug/slau367o/slau367o.pdf
출처: http://coyoteugly.tistory.com/188 [마이콤 개발자를 위한 여행]
0. 참고 사항
1. HW 연결
2. New Project > Microchip Embedded > Standalone Project
3. Device > PIC18F4520
4. Hardware Tools > PICkit3
5. Compiler > XC8
6. Project Name > BlinkLED
7. New File > Microchip Embedded > XC8 Compiler > main.c
8. File Name
9. main.c
10. Production > Set Configuration Bits
11. Set Configuration Bits & Generate Source Code to Output
- OSC > INTIO67
- Internal oscillator 쓸려고
- WDT > OFF
- watchdog 쓰지 않으므로
- LVP > OFF
- RB5 port에 영향을 줍니다.
12. Generate Source Code to Output
13.
14. Production > Build Main Project [ F11 ]
15. Download
16. 소스 설명
/* _XTAL_FREQ를 선언해 주고 pic18.h를 include하면 __delay_ms, _delay_us 등의 함수를 사용할 수 있습니다. */ #define _XTAL_FREQ 1000000 |
17. 소스
18. 결과
500ms 단위로 동작합니다.
'PIC18' 카테고리의 다른 글
PIC18, MPLAB X IDE, XC8, TIMER, Interrupt (0) | 2018.09.12 |
---|---|
PIC18, MPLAB X IDE, XC8, GPIO, Interrupt (0) | 2018.09.12 |
PIC18, MPLAB X IPE PICkit3 오류 발생 시 대응방법 (0) | 2018.07.31 |
PIC18, MPLAB X IPE 펌웨어 다운로드 (1) | 2018.07.31 |
PIC18, MPLAB X IDE 펌웨어 다운로드 시점에서 PICkit3 오류 발생 시 (0) | 2018.07.31 |