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

LED won't switch off!

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



Joined: 12 Jul 2013
Posts: 12

View user's profile Send private message

LED won't switch off!
PostPosted: Mon Jul 29, 2013 3:26 am     Reply with quote

I have an LED attached to RA6 on a 16F628A (via a resistor of course).

I want it to come on when

Code:
output_high(PIN_A6);


Is executed, but it's on all the time, even when I put

Code:
output_low(PIN_A6);


Near the beginning of main().

Any ideas guys?
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 29, 2013 5:15 am     Reply with quote

several but the first one is that you've not disabled any/all other internal peripherals that use PIN_A6.
The default use of an I/O pin is not always set to digital I/O.
IE: pins used for the ADC are typically defaulted for ADC use.
Kinda backwards in my opinion as 'in the beginning' there were only digital ins and outs...no 'fancy' peripherals like UARTS,ADC,comparators,timers,etc.

hth
jay
Mounty



Joined: 12 Jul 2013
Posts: 12

View user's profile Send private message

PostPosted: Mon Jul 29, 2013 7:58 am     Reply with quote

temtronic wrote:
several but the first one is that you've not disabled any/all other internal peripherals that use PIN_A6.
The default use of an I/O pin is not always set to digital I/O.
IE: pins used for the ADC are typically defaulted for ADC use.
Kinda backwards in my opinion as 'in the beginning' there were only digital ins and outs...no 'fancy' peripherals like UARTS,ADC,comparators,timers,etc.

hth
jay


Thanks. I'll look into disabling other features on the pin.
dyeatman



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

View user's profile Send private message

PostPosted: Mon Jul 29, 2013 11:26 am     Reply with quote

Mounty,
Since you didn't tell us your CCS version and show any initialization code
(fuses etc.), we don't know what oscillator you are using. It's hard to be
sure but, it's likely your fuses.
_________________
Google and Forum Search are some of your best tools!!!!
Mounty



Joined: 12 Jul 2013
Posts: 12

View user's profile Send private message

PostPosted: Mon Jul 29, 2013 1:00 pm     Reply with quote

dyeatman wrote:
Mounty,
Since you didn't tell us your CCS version and show any initialization code
(fuses etc.), we don't know what oscillator you are using. It's hard to be
sure but, it's likely your fuses.


Hi, no worries I just moved the LED onto RB6 and it works perfectly now.

Cheers.
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