It works for me also in simulation (with Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY remmed in) I rem it in and out as needed. It doesn't work properly in the circuit though, only GP2 flashes but not GP4 and GP5.
hi.
OK, I will relook at your program, get back to you.
E
EDIT:
I cannot see a problem in the program for those two LED's
Check that you have the LED's the correct way around and that they are connected to those pins.
E
hi.
OK, I will relook at your program, get back to you.
E EDIT:
I cannot see a problem in the program for those two LED's
Check that you have the LED's the correct way around and that they are connected to those pins.
E
Eric,
I have a test panel for electronics, so the LEDs are fine.
I did some tests, where I simplified the code, and changed whether a LED was on or off. I have attached the simple code.
If the LEDs are set to go on, then they stay on, so on the code I sent, only one LED comes on and stays on. If they are set not to come on then they don't light at all. No flashing.
UPDATE: I found that the voltage from the LED pin was 2.5V Which implies that it is flashing far too fast. I did a test where the LED was only set to turn on, and the voltage is now 5V.
This appears to be something to do with the internal clock. I'm not using XTALs, but if I can't find an answer will reluctantly add them.
I've been trying as many combinations as possible, and the attached code is the best I can get.
With T1CON commented out AN0 and AN1 turn GP2 and GP5 on ok, but the start up LEDs flash momentarily, so the clock is too fast.
With T1CON not commented out GP5 never turns on.
Any ideas?
Cheers, Camerart.
Attachments
TIMER INTERRUPT and AD Modified header TEST-AN0- AN1-GP2-GP5 S.bas
Remove the 1000 Waitms in the Toggle loop, let me know how that effects it.
You have a 0.5sec ISR running and a 1 Second wait.[/quote]
There is no Toggle LOOP (I hope I'm correct) but if you mean my test start up LEDs, if the 'WAITMS 1000' is removed from this, then there are no perceivable flashes.
The 0.5 second and 1 second wait is something that was set up for interrupts. I'll explain in the next reply.
I am slowly building up a TIMER program with A/D inputs for future use, I have to build up these modules, so I can call on them for useful programs I have planned.
Once I have the LEDs turning on ok, and the A/Ds working too, I'll then add the proper timer back in.
I have tried lots of different combinations of inputs and outputs, to get 2x leds to flash, while also having 2x A/D inputs and 1x digital input. I have only achieved 1 or 2 results, like the one I posted in #24, which is almost there apart from when WAITMS is used.
I wonder if perhaps WAITMS should not be used while the INTERRUPT routine is working???
I now use a proper lab test bed, because of odd results on the circuit board, I've tried 3xPICs including a new one, and I have moved the lead going to the LED, around the chip and still only GP2 flashes.
Is it possible that PICKIT2 is not properly programming? Or, as this is taking both of us a lot of effort, should I use a different chip?
I'm happy to post them to you, I'll pop them in the post tomorrow.
I've already made a remote heater from anywhere to my vehicle. This project is a spot welder for cells for an electric bike, and in the future I want to make a GPS follower, perhaps that will need a larger chip?
I'll wait for you to play with them before changing Chip.
I now use a proper lab test bed, because of odd results on the circuit board, I've tried 3xPICs including a new one, and I have moved the lead going to the LED, around the chip and still only GP2 flashes.
Have you checked the LED on GP5, its transistor and connections? Can you write a simple program to turn GP5 On and run the program to see if it is ever capable of turning on?
Have you checked the LED on GP5, its transistor and connections? Can you write a simple program to turn GP5 On and run the program to see if it is ever capable of turning on?
I presume you mean 'resistors' not 'transistors' In the circuit there is an ok resistor. On the test bed the resistors are built in.
If you check #24 you will see that everything is working, but the timing is wrong, as it's so fast that the start up flashes are milliseconds, not 1 second, and WAITMS commands don't work properly. I can get all 3x LEDs to flash 1 second, but with no A/D in, and I've moved inputs and outputs to many different patterns with no good result. The code I posted on #24 is the best.
On the PINS that I am having trouble with, there is a PIN selection for a clock-in and I think this is being interfered with.
I notice that there are no A/D inputs and GP5 is unused, this all makes a difference to the outcome. Best wait till you have the chips, to see if the same thing happens once the simulator show success and once in the circuit no success. Using the code I posted on #24. Perhaps you might find out where I'm going wrong.