|
|
View previous topic :: View next topic |
Author |
Message |
ismail66c
Joined: 09 Nov 2008 Posts: 6
|
12f675 |
Posted: Sun Nov 06, 2011 11:43 am |
|
|
Code: |
#include <12f675.h>
#device adc=10
#fuses NOPROTECT,NOBROWNOUT,NOMCLR,NOPUT,NOCPD,NOWDT,RC_IO
#use fast_io(a) //Port yönlendirme komutları A portu için geçerli
#byte oscal=0x90 //osilatör konfigürasyonu için tanımlı
#byte ansel=0x9f
#byte cmcon=0x19
#use delay(clock=4000000)
unsigned int16 a;
void main()
{
//oscal=0xFC; //bu satır olmasaydı osilatör default olarak 2MHz olacaktı.
// Bu satır osilatör calibrasyonunu yapmaktadır.
//0x80 2MHz(default), 0xFC 4MHZ
//setup_comparator(NC_NC_NC_NC);
cmcon=0x07;
setup_adc(an0_analog|adc_clock_internal);
//ansel=0x61;
//adcon=0x81;
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2);
//setup_timer_1(T1_DISABLED);
set_tris_a(0x01); // A portu komple çıkış
output_a(0x20);
set_adc_channel(0);
a=0;
basla:
a=read_adc();
output_toggle(pin_a5);
if(a>125)
{
output_high(pin_a2);
}else
{
output_low(pin_a2);
}
if(a>826)
{
output_high(pin_a1);
}else
{
output_low(pin_a1);
}
delay_ms(100);
goto basla;
}
|
When I run the above program, the "output_toggle (pin_a5);" line does not work, if that helps. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 06, 2011 11:56 am |
|
|
Quote: | #fuses NOPROTECT,NOBROWNOUT,NOMCLR,NOPUT,NOCPD,NOWDT,RC_IO
|
You should use the fuse INTRC_IO instead of RC_IO. Then Pin A5 will
probably work. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|