well... maybe not a bad idea to read the ADC again once in a while, as it is right now you read it only once![]()
well... maybe not a bad idea to read the ADC again once in a while, as it is right now you read it only once![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
About your POWER LED not coming on:
How about taking a copy of that last code, deleting all the lines except the absolute minimum to get the power LED on.
Just keep the config, variable, ports, etc. Get rid of everything else, it's cluttering your view.
I bet you have a config set up wrong, or your wiring is not exactly as you think it is.
Robert
Dumb question #1: Did you try to light the POWER LED and resistor directly to confirm it does indeed work?
#2: Maybe you blew the pin on the PIC, try another one.
#3: PWMOUT VAR GPIO.0 <-- Is this your POWER LED? You never turn it on, you only define it (or maybe I'm missing something).
#4: TRISIO = %00000111 <-- port 0 is set as input, it should be TRISIO = %00000110.
Last edited by Demon; - 24th April 2012 at 03:56. Reason: Cause I keep going back to the code and getting more ideas.
I also notice that you are not setting the CMCON0 register. If not then it is defaulting to GP0 and GP1 as analog inputs and GP2 as digital. If you are not using the comparator then you should be setting it to %00000111. This will allow port GP0 to be digital. It's all in the data sheet.....
Dave Purola,
N8NTA
EN82fn
I tried the resistor and the LED separately, with your help and looking through the datasheet again it does seem that it is the configuration settings.
Demon
- I was initally going to use these labels instead of the binary code for the pins, but I ended up using the binary numbers as I wanted to be able to turn more than one pin on and off at a time. Though the pin names are left in incase I wish to use them in the future.#3: PWMOUT VAR GPIO.0 <-- Is this your POWER LED? You never turn it on, you only define it (or maybe I'm missing something)
Dave
I never realised that I needed to set the CMCON0 register as I decided to not look into the comparator section of the datasheet as this is not a function I am using at this time. I'll spend more time reading the rest of the datasheet now to see if there is any other bits I have missed.
I shall look at the registers later tonight to see if there is anything else I have missed.
Many thanks for your help.
Dave
Always wear safety glasses while programming.
Actually Robert, He is comanding the power led to light every time he is sending the commands to the other led's with any of the GPIO statements like: GPIO = %00010001
Dave Purola,
N8NTA
EN82fn
Ah, thanks Dave, now I see it as plain as the nose on my face.
Bookmarks