View previous topic :: View next topic |
Author |
Message |
kzmsimsek
Joined: 14 Feb 2011 Posts: 3
|
OUTPUT_BIT() Command problem |
Posted: Mon Feb 14, 2011 8:54 am |
|
|
Hi pic programmers, i have a problem while using output_bit() command.
In the book it is written that for example if i use this code like this > output_bit(PINB0, 1) it means i am making the pinb0 high, for example output_bit(PINB0, 0) means that i am making the pinb0 low, but when i use this command in my program, it doesn't work. i could't find where the problem is. i need your help. thanks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Feb 14, 2011 9:18 am |
|
|
You'll have to post the program as well as the compiler version before any of us can help. Our crystal balls are cloudy today ! |
|
|
kzmsimsek
Joined: 14 Feb 2011 Posts: 3
|
|
Posted: Mon Feb 14, 2011 9:24 am |
|
|
you are right sorry. here is my programm. the programm is very simple but i am just trying to use output_bit() command.
when i compile the programm it is given an error that PINB0 in an undefined identifier.
#include <16f877.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay(clock=4000000)
#use fast_io(b)
void main ()
{
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_CCP1(CCP_OFF);
setup_CCP2(CCP_OFF);
set_tris_b(0*00);
output_b(0*00);
start:
output_bit(PINB0,1);
delay_ms(500);
output_bit(PINB0,0);
delay_ms(500);
goto start;
} |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Mon Feb 14, 2011 9:27 am |
|
|
Probably that the pin name, is PIN_B0, not PINB0.....
Other possibility, very old compiler. This function was not present on very old compilers.
Best Wishes |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Mon Feb 14, 2011 9:29 am |
|
|
I see you posted the program while I was typing. Pin name.
Best Wishes |
|
|
kzmsimsek
Joined: 14 Feb 2011 Posts: 3
|
|
Posted: Mon Feb 14, 2011 9:35 am |
|
|
Ttelmah thanks for warning me. I saw the problem. You are right. It must have been PIN_B0 not PINB0 . there is a mistake in the book. now it works. |
|
|
|