PIC Projects A Practical Approach (C, Assembly Based)
Naver
졸업작품 의뢰 필요하신분은 댓글 남겨주시거나 (▶LINK)를 눌러주세요
(다 받고 vol1을 압축해제하면 이어서 다 풀립니다.)
PIC A Practical Approach (PDF작업중).vol1.egg
PIC A Practical Approach (PDF작업중).vol2.egg
PIC A Practical Approach (PDF작업중).vol3.egg
PIC A Practical Approach (PDF작업중).vol4.egg
PIC A Practical Approach (PDF작업중).vol5.egg
PIC A Practical Approach (PDF작업중).vol6.egg
PIC A Practical Approach (PDF작업중).vol7.egg
PIC A Practical Approach (PDF작업중).vol8.egg
PIC A Practical Approach (PDF작업중).vol9.egg
▼다운로드 링크!!!
https://www.4shared.com/s/fDLAtIK99ca
Page 73
PIC12F629 - Flashing LED with a push button - C program
#include<pic12f6x.h>
void delay (void)
{
int j;
for(j=0; j<300; j++)
}
void main(void)
{
TRIS1 = 0; //set port pin 1 to output
TRIS4 = 1; //set port pin 4 to input
while(1)
{
if(GPIO4==1) //is the push button pressed ??
{
GPIO1==1 //port pin 1 is HIGH
delay(); //short delay
GPIO1==0 //port pin is LOW
delay(); //short delay
}
}
}
Page 74
PIC12F629 - Flashing LED with a push button - assembly program
;SW_LED_12F629.asm
include "p12f629.inc"
;global variables
T1 equ 26h
T2 equ 27h
T3 equ 28h
Main bsf STATUS,5 ;select bank for TRISIO
;http://what-when-how.com/pic-microcontroller/the-pic16f84-microcontroller-part-2/
movlw B'11111101' ;Set GPIO1 as Output, rest of them as Inputs
movwf TRISIO ;set GPIO1 as output
bcf STATUS,5 ;select bank0
again btfss GPIO,GP4 ;is the push button pressed? (if Yes, skip next line)
goto again ;not pressed, read again
bsf GPIO,GP1 ;set GPIO1 pin to 1
call Delay ;call Delay method
bcf GPIO,GP1 ;reset GPIO1 pin to 0
call Delay ;call Delay method
goto again ;Back to again "again" Label
; Delay 0.5 sec
Delay movlw 3 ; load values "3"
movwf T1 ; T1 = 3 (변수 T1에 3을 담는다.)
movlw 0EBh ; 14*16 + 11 = 235
; E is 14 in Hex, B is 11 in Hex
; LSB is 16^0, 16^1, 16^2 ... (getting up going to MSB)
; 0*16^2 + E*16^1 + B*16^0
DelT1 movwf T2 ;T2 = 235
DelT2 movwf T3 ;T3 = 235
DelT3 decfsz T3,1 ;T3=T3-1, repeat not 0
; decfsz : Decrease File, Skip if it is Zero
goto DelT3
decfsz T2,1 ;T2=T2-1, Decrease T2 by 1 (1씩 감소)
goto DelT2
decfsz T1,1 ;Decrease T1 by 1
goto DelT1
return
;
end