\r\n"); while(1) {"> \r\n"); while(1) {">
Sunuyu indir
Sunum yükleniyor. Lütfen bekleyiniz
YayınlayanOsamah SALMAN Değiştirilmiş 7 yıl önce
1
//UART KULLANIMI #define YLED_ON PORTD.B0=1 #define YLED_OFF PORTD.B0=0 + #define KLED_ON PORTD.B1=1 #define KLED_OFF PORTD.B1=0 unsigned short i; char txt[6]; char DRX; //UART DEĞİŞKENİ RECEIVE
2
void main() { ANSELA=0; //PORTA DIJITAL AYARLANDI !!!! ANSELD=0; //PORTD DIJITAL AYARLANDI !!!! ANSELB=0; //PORTB DIJITAL AYARLANDI !!!! ANSELC=0; //PORTC DIJITAL AYARLANDI !!!! ANSELE=0; //PORTE DIJITAL AYARLANDI !!!! TRISA = 255; TRISB = 0; TRISC = 0; TRISD = 0b00001100; TRISE = 0; Uart1_Init(9600); //UART 9600 BAUD AYARLANDI
3
PORTD.B0=1; PORTD.B1=1; PORTD.B7=1; Delay_ms(2000); PORTD.B0=0; PORTD.B1=0; PORTD.B7=0; Uart1_Write_Text("\r\n SERI HABERLESME v1.1\r\n"); Uart1_Write_Text("HAZIR >\r\n"); while(1) {
4
if(UART1_Data_Ready()==1) { DRX=UART1_Read(); UART1_Write('#'); } if(DRX=='1') { PORTD.B7=1;Uart1_Write_Text("BUZZER ON \r\n");} if(DRX=='2') { PORTD.B7=0;Uart1_Write_Text("BUZZER OFF\r\n");} if(DRX=='3') { KLED_ON;Uart1_Write_Text("KLED ON \r\n");} if(DRX=='4') { KLED_OFF;Uart1_Write_Text("KLED OFF \r\n");}
5
if(DRX=='5') { YLED_ON;Uart1_Write_Text("YLED ON \r\n");} if(DRX=='6') { YLED_OFF;Uart1_Write_Text("YLED OFF \r\n");} if (PORTD.b2==1) { Uart1_Write_Text("B2 BUTON.\r\n"); Delay_ms(1000); } if (PORTD.b3==1) { Uart1_Write_Text("B3 BUTON.\r\n"); Delay_ms(1000); } DRX=0; }
Benzer bir sunumlar
© 2024 SlidePlayer.biz.tr Inc.
All rights reserved.