Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I didn't get upset by your writing. I got upset by your (lack of) reading.i am sorry that you got so pissed off by my writing.
what exactly did you mean when you said "Any pins that are analogue work well as digital outputs"?
Exactly what I said.
Just can't toggle them LOL I was just trying the posters code and what millwood posted on what I had plugged in my bread board. When It didn't work on portC I read the data sheet and the chip I have has adc on portC. What Mike said always works for me.Any pins that are analogue work well as digital outputs".
Most of the time it always 1. or 4. like Mike postedIf PORTC=~PORTC doesn't work then some possible reasons are,
1. You have the pins still set to analogue as pointed out by Burt.
2. You have overloaded the pins and this is forcing them high/low. Normally by connecting LEDs without series resistors.
3. You forgot to switch the pins to output.
4. The pins are configured for some other peripheral.
5. One of the other reasons for pics not working - not programmed, no oscillator, no power etc.
Mike.
Well, when a pin is configured as an analogue pin it works very well as a digital output - there is no analogue output mode.
When you read it, it always reads zero unless you turn the analogue part off. So, x=~x will always write a 1 to any pins configured as analogue.
Mike.
Just can't toggle them LOL I was just trying the posters code and what millwood posted on what I had plugged in my bread board. When It didn't work on portC I read the data sheet and the chip I have has adc on portC. What Mike said always works for me.
Most of the time it always 1. or 4. like Mike posted
There a lot of people that ask why this not working and it most all ways because they leftso here goes back to my question that got you mad: why would you write anything to an analog pin? - that's how you use it for digital output.
They come on Highare those pins always high or always low?
If you read the data sheet you would see that any pin that is configured as analogue but set to output will act as a digital output.
However, if you try to read it you will get zero rather than the last value written.
BTW, it was you that started the writing to analogue pins with your PORTC=~PORTC.
There a lot of people that ask why this not working and it most all ways because they left
the PORT set as analogue.
the led wouldn't blink on portC ... turned adc off and all is well LOL
It is bad practice to set pins to output and to write to them when they are configured as analogue.
You presented code earlier in this thread that did just that.
You obviously haven't consulted a data sheet as you keep repeating the same stupid question.
It's bedtime for me. If you still don't understand it in 8 hours time then please reread this thread or consult a data sheet.
Mike.
Are you all righthopefully you have convinced yourself by now that the reason the code did not work is that the port configuration is wrong.