gokhangok865
Üye
- Katılım
- 19 Eyl 2008
- Mesajlar
- 8
- Puanları
- 1
- Yaş
- 40
arkadaslar oncelikle merhabalar.bitirme projesi olarak pic16f877 ile seri haberlesme devresi yapmam gerekti.devreyi kurdum fakat proteusun vitural terminalinden aldigim degerler cok garip.ben picle donusturdugum adc sonucunu gondermek istiyorum.fakat bir turlu basaramadim.£££xx £xxX seklinde degerler geliyor.bunun anlami ne olabilir.bu arada picin tx bacagini max232 nin Tin bacagina bagladim.Tout bacagini da proteusun terminalindeki Rx bacagina bagladim.sanirsam bu sekilde olmasi gerekiyor zaten biri bana yardim edebilirse cok sevinirim.
#include <16F877.h>
#device ADC=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#byte portb=6
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
#define fast_io(b)
#define use fast_io(a)
unsigned long int bilgi;
float gerilim,basinc;
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_TYPE 1
#include <Lcd.c>
void main()
{
lcd_init();
set_tris_b(0x00);
set_adc_channel(0);
delay_us(20);
set_tris_a(0xFF);
setup_adc(ADC_CLOCK_DIV_8);
setup_adc_ports(ALL_ANALOG);
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(true)
{
bilgi=read_adc();
gerilim=bilgi*0.018823529411764705882352941176471;
basinc=gerilim*1.4886686048548110266559249010473;
printf(lcd_putc," \r BASINC=");
lcd_gotoxy(12,1);
printf(lcd_putc,"%f",basinc);
portb=bilgi;
delay_ms(200);
printf("%lu",bilgi);
}
}
hata nerde?
Kod:
#include <16F877.h>
#device ADC=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#byte portb=6
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
#define fast_io(b)
#define use fast_io(a)
unsigned long int bilgi;
float gerilim,basinc;
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_TYPE 1
#include <Lcd.c>
void main()
{
lcd_init();
set_tris_b(0x00);
set_adc_channel(0);
delay_us(20);
set_tris_a(0xFF);
setup_adc(ADC_CLOCK_DIV_8);
setup_adc_ports(ALL_ANALOG);
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(true)
{
bilgi=read_adc();
gerilim=bilgi*0.018823529411764705882352941176471;
basinc=gerilim*1.4886686048548110266559249010473;
printf(lcd_putc," \r BASINC=");
lcd_gotoxy(12,1);
printf(lcd_putc,"%f",basinc);
portb=bilgi;
delay_ms(200);
printf("%lu",bilgi);
}
}
hata nerde?