stuuf21
Üye
- Katılım
- 13 Eki 2010
- Mesajlar
- 7
- Puanları
- 1
- Yaş
- 33
Basit bir devir sayıcı yaptım ve bunu rf yardımı ile diğer pic deki lcdye atamak istiyorum ama başaramadım.yazdığım kodalar bunlar yardım ederseniz sevirnirim.
verici
verici
Kod:
#include <16F877.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#include "C:\Users\ST\Desktop\CCS denemeler\yeni2\main.h"
#include <LCD.C>
#use fast_io(b)
#use fast_io(c)
#use fast_io(d)
int sayac,i;
float hiz;
void uyandir()
{
printf("0x55");
printf("0x55");
printf("0x55");
printf("0x55");
printf("0x55");
putc('x');
}
void gonder()
{
uyandir();
putc(hiz);
}
#int_ext
void ext_kesmesi()
{
sayac++;
}
#int_timer0
void timer0_kesme()
{
set_timer0(60);
i++;
if(i==20){
hiz=sayac;
sayac=0;
i=0;
printf(lcd_putc,"\f HIZ=%f KM/H" ,hiz);
gonder();
}
clear_interrupt(int_timer0);
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();
enable_interrupts(INT_EXT);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
while(1);
}
alıcı
#include <16F877.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#include <LCD.C>
#use fast_io(d)
#use fast_io(b)
#use fast_io(c)
int gelen;
float hiz;
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();
while(1)
{
if(getc()=='x') //öncü veriyi aldıysan
{
gelen=getc(); //gönderdiğim veriyi al
hiz=gelen;
printf(lcd_putc,"\f HIZ=%f KM/H" ,hiz);
}
}
}
Moderatör tarafında düzenlendi: