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

[solved] 24F32KA304 RA3 and RA4 stuck low?

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



Joined: 25 Apr 2012
Posts: 26

View user's profile Send private message

[solved] 24F32KA304 RA3 and RA4 stuck low?
PostPosted: Wed Aug 15, 2012 3:13 pm     Reply with quote

Another question regarding this device... I have most of the GPIO working, and the peripherals (ADC, SPI, UART) are also working. RA3 and RA4 are being used for GPIO but I don't seem to be able to get them to do what I'd like.

I'm using the regular output_high() to set them high, but they stay low. Neither are open-collector, and I have verified that I didn't accidentally configure RA3 for its analog function. I notice that both these pins share OSCO features, one for the primary oscillator and one the secondary.

As far as I am able to determine I have this secondary function disabled. OSCIO is the fuse for the primary oscillator, but I don't see a specific fuse for the secondary. I have clock switching disabled and as a precaution I have also tried setting the secondary oscillator mode to digital, but both RA3 and RA4 seem to be quite happy to stay at logic 0.

Is there something obvious I'm missing which would allow me to gain use of these pins?


Last edited by akohlsmith on Wed Aug 22, 2012 3:26 pm; edited 1 time in total
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Aug 15, 2012 3:28 pm     Reply with quote

Post a short complete compilable code which shows us exactly what you're doing.

Then we can test it.

Mike

EDIT.

Don't forget compiler version.
akohlsmith



Joined: 25 Apr 2012
Posts: 26

View user's profile Send private message

PostPosted: Wed Aug 22, 2012 11:38 am     Reply with quote

Sorry for the late update. I feel it's important to "close" the thread so that others may find some help in the future.

It appears that set_adc_channel() and/or read_adc() will override the pin configs, and I was using the sANx defines instead of the channel number for set_adc_channel(), which could have been buggering up things on the port configuration pretty good.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Aug 22, 2012 2:54 pm     Reply with quote

I suggest you edit your initial post to include "solved" in the heading.

That way we all can see it's closed without even looking.

Mike
akohlsmith



Joined: 25 Apr 2012
Posts: 26

View user's profile Send private message

PostPosted: Fri Aug 24, 2012 2:09 pm     Reply with quote

And for the final bit of info I've learned:

Code:
#fuses NOIESO
#fuses SOSC_DIGITAL


Is most certainly required to enable RA3/RA4. #use delay() sets up the PLL/drive strength/osc configuration correctly, but those two #fuses lines are what actually enable RA3/RA4 for I/O (as opposed to oscillator output/driver function).
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