1980best
Üye
- Katılım
- 1 Ağu 2006
- Mesajlar
- 18
- Puanları
- 1
- Yaş
- 40
////////////////////PİC18F252 İLE YAPILMIŞ BUTONA BAS LED YANSIN/////////////////
///////////////////////ALIN SİZE TÜRKÇE KAYNAK İŞTE////////////////////////
#include <18F252.h>
#use delay(clock=40000000)
#fuses H4,NOWDT,NOPROTECT,NOLVP,PUT,
#use rs232(baud=500000, xmit=PIN_C6, rcv=PIN_C7)
#BYTE PORTA = 0xF80
#BYTE PORTB = 0xF81
#byte PORTC = 0xF82
//******************************************************************************
#BIT RA0 = PORTA.0
#BIT RA1 = PORTA.1
#BIT RA2 = PORTA.2
#BIT RA3 = PORTA.3
#BIT RA4 = PORTA.4
#BIT RA5 = PORTA.5
//******************************************************************************
#BIT RB0 = PORTB.0
#BIT RB1 = PORTB.1
#BIT RB2 = PORTB.2
#BIT RB3 = PORTB.3
#BIT RB4 = PORTB.4
#BIT RB5 = PORTB.5
#BIT RB6 = PORTB.6
#BIT RB7 = PORTB.7
//******************************************************************************
INT TUR;
void main()
{
SET_TRIS_A(0);
SET_TRIS_B(0);
SET_TRIS_C(0);
RB0=1; /////////
RB1=1;/////////////
RB2=1;/////////////
RB3=1;//////////////
RB4=1;/////////////// RB X UÇLARI BİR BUTONLA ŞASEYE BAĞLI : BUTONA BASILIRSA RBX SIFIR OLUR LED YANAR
RB5=1;/////////
RB6=1;//////
RB7=1;////
RC0=0;
RC1=0;
RC2=0;
RC3=0;
RC4=0;
RC5=0;// BUZZER BAGLI
RC6=0;
RC7=0;
RD0=1;// LED BAĞLI
RD1=1;//LED
RD2=1;// LED
RD3=1;//LED
RD4=1;//LED
RD5=1; //LED
RD6=1;//LED
RD7=1;//LED
while (1)
{
IF (!RB1) {RD7=0; RC5=1;}
IF (!RB2) {RD7=0; RD6=0; RC5=1;}
IF (!RB3) {RD7=0; RD6=0; RD5=0; RC5=1;}
IF (!RB4) {RD7=0; RD6=0; RD5=0; RD4=0; RC5=1;}
IF (!RB5) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RC5=1;}
IF (!RB6) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RD2=0; RC5=1;}
IF (!RB7) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RD2=0; RD1=0; RC5=1;}
IF ((RB1)&&(RB2)&&(RB3)&&(RB4)&&(RB5)&&(RB6)&&(RB7)) {RD7=1; RD6=1; RD5=1; RD4=1; RD3=1; RD2=1; RD1=1; RC5=0;}
RD0=0;
delay_ms(100);
RD0=1;
delay_ms(100);
}
}
// RB LERİN UCU ŞASEYE BUTONLA BAğLI YANİ BUTONA BASINCA RB UçLARINDAN BİRİ SIFIR OLUYOR VE DİğER BACAKTAKİ LED YANIYOR.....VB
///////////////////////ALIN SİZE TÜRKÇE KAYNAK İŞTE////////////////////////
#include <18F252.h>
#use delay(clock=40000000)
#fuses H4,NOWDT,NOPROTECT,NOLVP,PUT,
#use rs232(baud=500000, xmit=PIN_C6, rcv=PIN_C7)
#BYTE PORTA = 0xF80
#BYTE PORTB = 0xF81
#byte PORTC = 0xF82
//******************************************************************************
#BIT RA0 = PORTA.0
#BIT RA1 = PORTA.1
#BIT RA2 = PORTA.2
#BIT RA3 = PORTA.3
#BIT RA4 = PORTA.4
#BIT RA5 = PORTA.5
//******************************************************************************
#BIT RB0 = PORTB.0
#BIT RB1 = PORTB.1
#BIT RB2 = PORTB.2
#BIT RB3 = PORTB.3
#BIT RB4 = PORTB.4
#BIT RB5 = PORTB.5
#BIT RB6 = PORTB.6
#BIT RB7 = PORTB.7
//******************************************************************************
INT TUR;
void main()
{
SET_TRIS_A(0);
SET_TRIS_B(0);
SET_TRIS_C(0);
RB0=1; /////////
RB1=1;/////////////
RB2=1;/////////////
RB3=1;//////////////
RB4=1;/////////////// RB X UÇLARI BİR BUTONLA ŞASEYE BAĞLI : BUTONA BASILIRSA RBX SIFIR OLUR LED YANAR
RB5=1;/////////
RB6=1;//////
RB7=1;////
RC0=0;
RC1=0;
RC2=0;
RC3=0;
RC4=0;
RC5=0;// BUZZER BAGLI
RC6=0;
RC7=0;
RD0=1;// LED BAĞLI
RD1=1;//LED
RD2=1;// LED
RD3=1;//LED
RD4=1;//LED
RD5=1; //LED
RD6=1;//LED
RD7=1;//LED
while (1)
{
IF (!RB1) {RD7=0; RC5=1;}
IF (!RB2) {RD7=0; RD6=0; RC5=1;}
IF (!RB3) {RD7=0; RD6=0; RD5=0; RC5=1;}
IF (!RB4) {RD7=0; RD6=0; RD5=0; RD4=0; RC5=1;}
IF (!RB5) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RC5=1;}
IF (!RB6) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RD2=0; RC5=1;}
IF (!RB7) {RD7=0; RD6=0; RD5=0; RD4=0; RD3=0; RD2=0; RD1=0; RC5=1;}
IF ((RB1)&&(RB2)&&(RB3)&&(RB4)&&(RB5)&&(RB6)&&(RB7)) {RD7=1; RD6=1; RD5=1; RD4=1; RD3=1; RD2=1; RD1=1; RC5=0;}
RD0=0;
delay_ms(100);
RD0=1;
delay_ms(100);
}
}
// RB LERİN UCU ŞASEYE BUTONLA BAğLI YANİ BUTONA BASINCA RB UçLARINDAN BİRİ SIFIR OLUYOR VE DİğER BACAKTAKİ LED YANIYOR.....VB