If you check my post, initially I was using HIGH/LOW. But it does not work. TRIS works, but not completely.
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
Assuming we refer to the first program, the ENDIF it there at the end.
On the snippets it is missing, but I doubt that this can compile anyway.
Ioannis
I don't use this particular Model T PIC, so I reserve the right to miss some quirks. Here are things I would check:
1. You don't list your CONFIGs, but try disabling the WDT. It could be resetting on you.
2. Try enabling CLKOUT and verify oscillator. On one project I did years ago, I had the crystal too far from the OSC pins and it would work for a few seconds then Peter out.
3. Not sure which PORT PIN is MCLR, but you only have one Input in your TRISx Registers. MCLR should be a "1" (even though it probably defaults to Input Only). Don't forget the pull-up resistor.
4. Make sure there are no other default settings triggering things unexpectedly (like Comparator or something).
5. I think you already tried removing the PICkit3 programmer before trying the code. Using PORTB.7 probably ties into a PICkit3 programming pin.
Some food for thought, things to try. Hope it helps.
Bookmarks