ADCON1 is not used that way on this chip so get rid of that. If that does not solve the problem I would look at your hardware setup. Something giving a false signal . How is the solenoid connected ?
ADCON1 is not used that way on this chip so get rid of that. If that does not solve the problem I would look at your hardware setup. Something giving a false signal . How is the solenoid connected ?
Dave
Always wear safety glasses while programming.
I had thrown a 2 second pause in to allow for things to stabilize, then I read the post where the pause should be before the tris statement is made. I'll try that.
I will try removing adcon as well.
The solenoid is hooked up via an output from a digital pin. When the pin goes high it trips a 2N3904 which completes a circuit for a 12V relay which then fires the solenoid itself.
Both the solenoid and the relay have protection diodes in place.
The solenoid is running a regulated air system.
I did have this system working with a 16f819, but my computer crashed and I didn't have a backup (silly me). I can confirm that the general scheme I used components wise has worked completely in the past. The only thing that is substantially different is the pic, and I put more of the components on the circuit board.
removing adcon had no effect, and the pause prior to the tris statements didn't seem to do anything either.
Unfortunately I leave again, and won't have a chance to work on it again for a while. I think these initial statements are where the problem resides. Something transient to do with the interplay between configuration, and hardware just as power is applied.
Can anyone tell me about the difference between ADSEL and ANSEL? I have seen references to ADSEL and the 16f88 by people using other compilers than pbp.
-Mike
So from the code and your statement it looks like either the first "if startbutton = 1 then goto checkvalues" is reading incorrectly; or perhaps the first "flashingled = 0" is not being executed.
Your initial settings look fine. You can remove the ADCON1 as this chip does not have this. I would perhaps have the order different (i.e. @device first), but I do not think it should make a difference.
How is the "startbutton" input connected? Is it sharing anything with the solenoid?
How is the "flashingled" connected?
If you disconnect the solenoid output, does the code runs as expected?
Try to set portA and B to zero before TrisCode:'declare inputs and outputs appropriately PortA = 0 PortB = 0 TRISA = %00111100 ' a.5 is INPUT only TRISB = %11100100
What value is your pulldown resistor?
Al.
All progress began with an idea
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
The following may correct any R-W-M mismatch condition, but it is a little risky to write to the output latch (even if not an output) when it maybe directly connected to +5V (through the SW):Would an initial read to the port, before the actual loop, do the same?Code:PortA = 0 PortB = 0
The RBPU should be disabled by default (unless PBP assigns it behind the scenes).
For these reasons I would have the port connected to +5V through a 10k resistor; and the switch would connect the port to GND (may be through 1k for protection).
The following post may give some ideas (not identical, but helps illustrate): http://www.picbasic.co.uk/forum/show...t=weak+pull-up
Last edited by languer; - 26th August 2009 at 10:00. Reason: update with link to post
Bookmarks