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

RA5 Not acting as general output

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



Joined: 13 Feb 2012
Posts: 21

View user's profile Send private message

RA5 Not acting as general output
PostPosted: Mon Feb 13, 2012 7:20 pm     Reply with quote

Hi,

Trying to run two Stepper motors off a PIC16F887.

One stepper motor works just fine, but the second does not. This I've worked out is due to the fact that RA5 (Pin 7) is not outputting a signal like it's meant to, but just staying high at 5V.

I've looked at the data sheets and I think it may just be acting as a comparator output?

I've tried a few things I've found on setting it to not use the comparators such as:

Code:
setup_adc_ports(NO_ANALOGS);

setup_comparator(0x00);

 OSCCON = 0b01110101;



(Not all together, separately)

But it's just doing exactly the same. It's just this one pin, all the rest are doing what they should.

There must be a simple way of doing this, surely?

Using MPLAB IDE 8.83 and CCS Compiler version 4.3.0.323
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Feb 13, 2012 8:19 pm     Reply with quote

Quote:
CCS Compiler version 4.3.0.323


That's not the compiler version. The version is in the format 4.xxx and is found at the top of your .LST file.
_________________
Google and Forum Search are some of your best tools!!!!
FreakShow!



Joined: 13 Feb 2012
Posts: 21

View user's profile Send private message

PostPosted: Mon Feb 13, 2012 8:39 pm     Reply with quote

Apologies. It is 4.120
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Mon Feb 13, 2012 8:51 pm     Reply with quote

RA5 on some chips is an open drain output. Consult the data sheet.
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Feb 13, 2012 9:31 pm     Reply with quote

Try the #BYTE fix in this post...

http://www.ccsinfo.com/forum/viewtopic.php?t=33789
_________________
Google and Forum Search are some of your best tools!!!!
FreakShow!



Joined: 13 Feb 2012
Posts: 21

View user's profile Send private message

PostPosted: Tue Feb 14, 2012 8:47 am     Reply with quote

Sorry, but there doesn't seem to be any #Byte.

As to newguy, the data sheet it says that you can use it as a general I/O pin.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue Feb 14, 2012 9:24 am     Reply with quote

OK.
Let's step back. Things potentially on this pin:

1) AN4.
2) Comparator 2 output.
3) Slave select input.

So:
Code:

setup_adc_ports(NO_ANALOGS);
setup_comparator(NC_NC_NC_NC);
setup_spi(FALSE);


Now, immediate comment - your compiler seems to have a fault, with the comparator definitions being _missing_ for this chip. There for the 877A, but not for the 877.
The value to turn off the comparators, is not '0'. It is 0xFF07. The register to control this, is CM2CON0, not 'OSCCON', which is the oscillator configuration register....
So I don't think you are turning the comparator off. Add your own

#define NC_NC_NC_NC 0x0FF07

and try with the setup_comparator line shown.

Best Wishes
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue Feb 14, 2012 11:27 am     Reply with quote

Sorry, don't know how the wrong link got into the post so here it is again.

http://www.ccsinfo.com/forum/viewtopic.php?t=33809

I double checked this one... Smile
_________________
Google and Forum Search are some of your best tools!!!!
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