CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

OUTPUT_BIT() Command problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kzmsimsek



Joined: 14 Feb 2011
Posts: 3

View user's profile Send private message

OUTPUT_BIT() Command problem
PostPosted: Mon Feb 14, 2011 8:54 am     Reply with quote

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: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 14, 2011 9:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Feb 14, 2011 9:24 am     Reply with quote

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: 19545

View user's profile Send private message

PostPosted: Mon Feb 14, 2011 9:27 am     Reply with quote

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: 19545

View user's profile Send private message

PostPosted: Mon Feb 14, 2011 9:29 am     Reply with quote

I see you posted the program while I was typing. Pin name.

Best Wishes
kzmsimsek



Joined: 14 Feb 2011
Posts: 3

View user's profile Send private message

PostPosted: Mon Feb 14, 2011 9:35 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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