No. I want to make PORTB.7 output logical "1" and then logical "0". PBP statements like HIGH PORTB.7 work, but only if I do not read PORTA.0 as input.
No. I want to make PORTB.7 output logical "1" and then logical "0". PBP statements like HIGH PORTB.7 work, but only if I do not read PORTA.0 as input.
So, why in your loop, you use TRIS to make the ports input then output? You should use High Portb.7 or Low Portb.7 and not TRIS. TRIS is only to define the input or output operation.
Ioannis
If you check my post, initially I was using HIGH/LOW. But it does not work. TRIS works, but not completely.
You insist on TRIS. The purpose of TRIS is completely different than what you trying to do...
You set once on the top of your program what every port will be (input or output) with the TRIS command and then you do not touch it again. Except if you want to change a port from output to input intentionally.
If you want to control the state of an output port you only use High and Low of that specific port.
Ioannis
I absolutely do not care about what statement it will be.
I'm asking why it does not works, whenever it is HIGH/LOW or TRIS.
OK. Lets stick on your first code that looks OK to me.
What is connected to your buzzer output? Can you connect only a LED with a resistor for testing purposes?
And I would also consider having decoupling capacitors the power rails, as close as possible to the PIC power pins.
Maybe you have an interference of the buzzer if it is electromagnetic?
Ioannis
Hey CuriousOne, Where is the ENDIF to finish the "if BUTN=0 then" statement?
Dave Purola,
N8NTA
EN82fn
Bookmarks