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

16F690 Problem

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







16F690 Problem
PostPosted: Thu Feb 22, 2007 8:22 am     Reply with quote

My problem is I cant use PIN_C0 and PIN_C1 same time

my compiler 3.249 .what is wrong or missing in this program.Help me please

Code:


void main()
{


do {


OUTPUT_HIGH(PIN_C0);
OUTPUT_HIGH(PIN_C1);
       
delay_ms(2000);
OUTPUT_LOW(PIN_C0);
OUTPUT_LOW(PIN_C1);
delay_ms(2000);
 
}while(true);
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Feb 22, 2007 9:37 am     Reply with quote

Which PIC processor are you using? Odds are it is a PIC16 with the famous "read, modify, write" problem. Use the search function of this forum to get more info on this issue.

Try the program below, if it works you can be sure it is the RMW problem.
Code:
void main()
{
  do
  {
    OUTPUT_HIGH(PIN_C0);
    delay_ms(100);
    OUTPUT_HIGH(PIN_C1);
    delay_ms(2000);

    OUTPUT_LOW(PIN_C0);
    delay_ms(100);
    OUTPUT_LOW(PIN_C1);
    delay_ms(2000);
  }while(true);
}
erkankocakaya
Guest







Thanks
PostPosted: Thu Feb 22, 2007 1:36 pm     Reply with quote

PIC 16F690 I am using.When I use below code C0 and C1 pins dont high
only B4 and B6 light the leds

Why do you think?

Code:


main()
{
OUTPUT_HIGH(PIN_C0)
delay_ms(250);
OUTPUT_HIGH(PIN_C0)
delay_ms(250);
OUTPUT_HIGH(PIN_C1)
delay_ms(250);
OUTPUT_HIGH(PIN_C1)
delay_ms(250);
OUTPUT_HIGH(PIN_B4)
delay_ms(250);
OUTPUT_HIGH(PIN_B4)
delay_ms(250);
OUTPUT_HIGH(PIN_B6)
delay_ms(250);
OUTPUT_HIGH(PIN_B6)
delay_ms(250);
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 22, 2007 11:56 pm     Reply with quote

There's a bug in the startup code for the 16F690 in PCM vs. 3.249.
Comparator #2 is turned on by mistake. That's why pins C0 and C1
don't work. You can fix this by adding the line of code shown in bold
below, at the start of your program:
Quote:

void main()
{
setup_comparator(NC_NC_NC_NC);


while(1);
}
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