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

PIC16F684 PIN_C0 wont stay high when set.

 
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go
View previous topic :: View next topic  
Author Message
Chris



Joined: 11 Nov 2004
Posts: 8

View user's profile Send private message

PIC16F684 PIN_C0 wont stay high when set.
PostPosted: Wed Dec 29, 2004 11:21 am     Reply with quote

Hi All,
I am trying to finish a servo controller routine and noticed the motor gets very twitchy when running at certain speeds.

I isolated the faulty code and recreated the problem with the following snippet:
#include <16F684.h>

#fuses HS,NOWDT,NOPUT,NOMCLR,NOPROTECT,NOBROWNOUT,NOIESO,NOFCMEN,NOCPD
#use delay(clock=20000000)

main()
{
*0x91=0; //clear ANSEL
*0x1F=0; //ADCON0
*0x9F=0; //ADCON1
*0x85=0; //TRISA
*0x87=0; //TRISC
*0x19=0; //CMCON0
*0x16=0; //PWM1CON
while(1)
{
OUTPUT_high ( PIN_C0 );
OUTPUT_high ( PIN_C2 );

}
}

I tried clearing as many registers as possible so they arent configured as somthing else. Have I got them all?

I want this code to set C0 high and C2 high. What I get is C0 creates a high frequency pulse train. It goes high until C2 is set then it goes low until C0 is set high again. C2 stays low and never goes high. Odd?

I have already had advice which highlighted faults in the CCS compiler for the 684 CCP features (which affected the digital pins too) and now suspect either another compiler fault or I havent configured something correctly but I have spent lots of time trying to track down the fault.

I can run the final code perfectly on a PIC16F877 version of the hardware.

Advice appreciated please.

Best Regards

Chris
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 29, 2004 2:24 pm     Reply with quote

This question should be re-posted in the General Discussion Forum.
You posted it in the Programmers forum by mistake.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Wed Dec 29, 2004 2:25 pm     Reply with quote

You need to read the data sheet, DS41202C, page 40.
_________________
David
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go 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