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 support@ccsinfo.com

18F2550 porta problem

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



Joined: 24 Jan 2010
Posts: 14

View user's profile Send private message

18F2550 porta problem
PostPosted: Sun Jan 23, 2011 9:14 am     Reply with quote

I am having a problem understanding why my 18F2550 processor will not change port A pin states properly. PIN_A4 will not change using output_low(PIN_A4) or output_bit(PIN_A4, 0). The same is true if I try to set them high. Looking at the watch window in mplab (PORTA) I see the PIN_A1 bit change instead. Here are my setup statements :
Code:

 setup_port_a( AN0_ANALOG );
  setup_adc( ADC_CLOCK_INTERNAL );   
  setup_spi(SPI_SS_DISABLED);
  setup_timer_1(T1_DISABLED);
  setup_timer_2(T2_DISABLED,0,1);
  setup_comparator(NC_NC_NC_NC);
  setup_vref(FALSE);

  set_tris_e(0x0f);
  set_tris_a(0x0f);

What have I missed?

Thanks Much
Brian
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 23, 2011 3:36 pm     Reply with quote

Make a simple program that only toggles Pin A4, and it should work.
Example:
Code:

#include <18F2550.h>
#fuses HS, NOWDT,BROWNOUT, PUT, NOLVP, CPUDIV1
#use delay(clock=20000000)
//======================================
void main(void)
{

while(1)
  {
   output_high(PIN_A4);
   delay_ms(500);
   output_low(PIN_A4);
   delay_ms(500);
  }

}
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