I have a problem with my PIC16F631 chip and PORTA.4
First of I set it's state to low and then set it to be an input port:
Code:
PORTA = 0b101100;
TRISA = 0b011011;
Further down the code I check if the port it high or not.
If the port is high I show this by turning on some lights and if it's low I turn them off.
Ok, so far so good, but here's were it goes bad.
If the input on the port goes high the program does what it should, but if it goes low again, at any given time after that, the port stays high and therefore my program think the input on the port is high when in fact it's the port that's high.
PORTA.4 is the only port doing this.
I hope some of you clever Pic coders can help me figure this one out.
Not on that chip it the same as 16f690 even has wpu on portA . Do you have more code then that hard to tell by that whats changing it state
did you set it up something like this
Oscillator = Internal RC No Clock
Watchdog Timer = Off
Power Up Timer = Off
Master Clear Enable = Internal
Code Protect = Off
Data EE Read Protect = Off
Brown Out Detect = BOD enabled in run, disabled in sleep, SBOREN disabled
Internal External Switch Over Mode = Disabled
Monitor Clock Fail-safe = Disabled
There is a resistor (47K), but that's only there as to not fry the PIC. I previously used PORTC.7 but I had to change to PORTA.4 because C.7 has not interrupt =(
I had not problems with C.7 other than the missing interrupt.
All I do is run around in a loop and check whether PORTA.4 is high or low
If it's high I call a function that turns on a series of lights and if it's low I turn the lights off.
My problem is that once PORTA.4 has been high it won't go low again even though the input on the port is low, so it would seem like what is really happening is that the port, once having been high has gone from an input port to an output port, or something like it.
I can't use that ASM code with CC5X, getting some strange error.
I set my config to this value
11001011010100
which is the same as
32D4
I seems as if the port has some SCHMITT TRIGGER or something like it that's keeping it high once triggered, I just can't see how to change it if that's the case
As far as I can see that is for PIC16F690 and I use 16F631. I don't know whether or not there's a difference, but it doesn't work with 00D4 as my config setting.
The port still stays high once the input has been high.
I no what it is but I don't see it doing any thing in what you posted and if some where you used it on RA4 the pin state can change if not restored after the interrupt