Örnek ccs c flasher kodu:
#include <12f683.h>
#fuses NOWDT,INTRC_IO,NOMCLR
#use delay(clock=4m)
void main()
{
set_tris_a(0b000000);
output_a(0b000000);
while(true)
{
output_high(pin_a0);
delay_ms(500);
output_low(pin_a0);
delay_ms(500);
}
}
Örnek kodun asm çeviri kodları:
.................... #include <12f683.h>
.................... //////////// Standard Header file for the PIC12F683 device ////////////////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996, 2014 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... #device PIC12F683
....................
.................... #list
....................
.................... #fuses NOWDT,INTRC_IO,NOMCLR
.................... #use delay(clock=4m)
0004: MOVLW 26
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 017
0009: MOVLW 01
000A: MOVWF 21
000B: CLRF 20
000C: DECFSZ 20,F
000D: GOTO 00C
000E: DECFSZ 21,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 20
0012: DECFSZ 20,F
0013: GOTO 012
0014: GOTO 015
0015: DECFSZ 00,F
0016: GOTO 009
0017: RETURN
....................
.................... void main()
0018: MOVF 03,W
0019: ANDLW 1F
001A: MOVWF 03
001B: MOVLW 61
001C: BSF 03.5
001D: MOVWF 0F
001E: CLRF 10
001F: MOVF 0F,W
0020: BCF 03.5
0021: BCF 1F.6
0022: BSF 03.5
0023: BCF 1F.0
0024: BCF 1F.1
0025: BCF 1F.2
0026: BCF 1F.3
0027: MOVLW 07
0028: BCF 03.5
0029: MOVWF 19
.................... {
.................... set_tris_a(0b000000);
002A: MOVLW 00
002B: BSF 03.5
002C: MOVWF 05
.................... output_a(0b000000);
002D: CLRF 05
002E: BCF 03.5
002F: CLRF 05
.................... while(true)
.................... {
.................... output_high(pin_a0);
0030: BSF 03.5
0031: BCF 05.0
0032: BCF 03.5
0033: BSF 05.0
.................... delay_ms(500);
0034: MOVLW 02
0035: MOVWF 25
0036: MOVLW FA
0037: MOVWF 26
0038: CALL 004
0039: DECFSZ 25,F
003A: GOTO 036
.................... output_low(pin_a0);
003B: BSF 03.5
003C: BCF 05.0
003D: BCF 03.5
003E: BCF 05.0
.................... delay_ms(500);
003F: MOVLW 02
0040: MOVWF 25
0041: MOVLW FA
0042: MOVWF 26
0043: CALL 004
0044: DECFSZ 25,F
0045: GOTO 041
0046: GOTO 030
.................... }
.................... }
0047: SLEEP
Configuration Fuses:
Word 1: 3FC4 INTRC_IO NOWDT PUT NOMCLR NOPROTECT NOCPD BROWNOUT IESO FCMEN
Hiç yorum yok:
Yorum Gönder
Her yorum bilgidir. Araştırmaya devam...