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

possibly a bug [RESOLVED]

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



Joined: 23 Jun 2010
Posts: 7

View user's profile Send private message

possibly a bug [RESOLVED]
PostPosted: Tue Jul 20, 2010 4:37 am     Reply with quote

Hi. The following little code does not work. 2 LEDs are connected to pin A4 and A5, and pin A4 does not light up the LED but pin A5 does. There is a problem with pin A4.

Compiler Version: 4.068
Code:

#include <16F876A.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#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


#use delay(clock=20000000)

void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   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);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   
while(1)
{
output_high(PIN_A4);
output_high(PIN_A5);
 }}


Last edited by smoglu on Tue Jul 20, 2010 5:54 am; edited 1 time in total
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Jul 20, 2010 5:37 am     Reply with quote

On some PICs pin A4 is Open Collector, ie. it will not pull high, it only pulls low. Check the datasheet for your PIC as I am not familiar with the 16F876A.
_________________
The search for better is endless. Instead simply find very good and get the job done.
smoglu



Joined: 23 Jun 2010
Posts: 7

View user's profile Send private message

PostPosted: Tue Jul 20, 2010 5:53 am     Reply with quote

Yes, you are right. PIC datasheet says A4 is open-drain type.
Thanks.
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