Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic16f887 adc compare problem

Status
Not open for further replies.

wizardgrt

New Member
Hello!

I'm almost as new in programming pic microcontrollers in assembly language.
What i tried to do in program, is to compare two results of AD conversion, by subtracting previous, from the current result of conversion. If the previous result is greater then the current, diode should be turned off and the program stops, otherwise it's turned on. Measured (input) voltage is from potentiometer 10k. Frequency is at 8 MHz. Problem is that diode is turned off, with no matter if the previous voltage is grater or not. On reset the situation is like it should be before reset, until the resistance is changed. It seems that the CARRY flag is cleared whenever input voltage is beeing changed. Help me please!!!!:(
 

Attachments

  • assemblycode.asm
    3.1 KB · Views: 153
Last edited:
I'm using Mikroelektronika's EasyPIC5 development tool, with integrated PICFlash which has an in-circuit debugger.
 
To be honest, i didn't. The user's manual is little bit confusing... Could you take a look at the code... i tought that that the bouncing of potentiometer could be the problem, because on simulator everything works fine.
 
Your best bet is to learn how to use the debugger, it will show you the code and the registers in either real time or single step.

I can't read the comments in your code as they're not English
 
Like I said before, give it a run through the debugger first and see if you can find the problem. This is a great tool for finding code bugs.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top