View previous topic :: View next topic |
Author |
Message |
Mounty
Joined: 12 Jul 2013 Posts: 12
|
LED won't switch off! |
Posted: Mon Jul 29, 2013 3:26 am |
|
|
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: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Jul 29, 2013 5:15 am |
|
|
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
|
|
Posted: Mon Jul 29, 2013 7:58 am |
|
|
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
|
|
Posted: Mon Jul 29, 2013 11:26 am |
|
|
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
|
|
Posted: Mon Jul 29, 2013 1:00 pm |
|
|
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. |
|
|
|