Previous in Forum: File Downloads - Under the Hood   Next in Forum: Windows XP Screensaver Problem
Close
Close
Close
7 comments
Rate Comments: Nested
Member

Join Date: Jul 2009
Posts: 6

Assembly Program for PIC 16F84

08/09/2009 2:39 PM

Hi,

Can anybody help me by providing assembly program for sensing a resistor value in PIC 16F84.

Thanks,

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#1

Re: Assembly Program for PIC 16F84

08/09/2009 8:18 PM

Please give more detail - describe what you want to measure (range of values etc) and any circuit configuration which is relevant.

AFAIK, this device has no analog inputs - how do you propose to measure the resistance?

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Member

Join Date: Jul 2009
Posts: 6
#2
In reply to #1

Re: Assembly Program for PIC 16F84

08/09/2009 8:25 PM

Thanks John

I have to find another PIC

Register to Reply
Guru
Engineering Fields - Electrical Engineering - Analog and Digital Circuit Design Engineering Fields - Electromechanical Engineering - Transformers, Motors & Drives, EM Launchers Engineering Fields - Engineering Physics - Applied Electrical, Optical, and Mechanical

Join Date: Jan 2008
Location: NY
Posts: 1207
Good Answers: 119
#3
In reply to #2

Re: Assembly Program for PIC 16F84

08/09/2009 10:48 PM

Microchip provides a large library of appnotes and assembly listings on how to do just about anything with a PIC. Check out their site . You actually DON'T need one with an A2D input to do the mesurement you want.

Register to Reply
Guru

Join Date: Dec 2005
Location: Etats Unis
Posts: 1871
Good Answers: 45
#4

Re: Assembly Program for PIC 16F84

08/09/2009 10:59 PM

It's really easy. You only need to use a capacitor that gets charged by the resistor and count time. Of course it isn't linear so you will need to allow for that and a look up table would be a simple way to implement that. Use output mode to discharge the cap, go to input mode and count until the bit toggles. Make sure you use an input with a schmidt trigger to get the best threshold repeatability. You can find sample code for this on the MC website as noted by another poster.

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Guru
Engineering Fields - Electrical Engineering - Analog and Digital Circuit Design Engineering Fields - Electromechanical Engineering - Transformers, Motors & Drives, EM Launchers Engineering Fields - Engineering Physics - Applied Electrical, Optical, and Mechanical

Join Date: Jan 2008
Location: NY
Posts: 1207
Good Answers: 119
#5

Re: Assembly Program for PIC 16F84

08/09/2009 11:43 PM

We did it before they offered A2D inputs. It has been a few years, but I'm pretty sure we used:

1) A reference capacitor connected to a 1st i/o
2) A reference resistor on a 2nd i/o for charge and discharge timing
3) The unknown resistor (thermistor in our case) on a 3rd i/o for charge and discharge timing.

I believe measuring both charge and discharge times gave the most accurate results, but review app-notes for best fit to your needs. Code example should be on Microchip site, but may be hard to find.

Register to Reply
Member

Join Date: Jul 2009
Posts: 6
#6
In reply to #5

Re: Assembly Program for PIC 16F84

08/10/2009 5:51 AM

Thanks it seems good method

Register to Reply
Member

Join Date: Jun 2008
Location: Tampa Bay, FL
Posts: 9
#7

Re: Assembly Program for PIC 16F84

08/10/2009 11:43 AM

First, why do you want to use that chip! What you are asking is impractical. In engineering practice, we use what is the most simple approach to solving a problem with the shortest amount of man-hours(time) involved.

1. Find a PIC like the PIC16F526 that has a built in ADC

2. When employing the PIC, it's best to make sure you have an external oscillator for your PIC. Using the internal clock yields some noisy results.

3. When writing your code, implement a run-time averaging filter

pseudocode:

avg = sum( past_averages[] ) /MAX_PAST_AVERAGES

That seemed to work for me!

post more information to your problem and ask more questions

__________________
live the experience...
Register to Reply
Register to Reply 7 comments
Copy to Clipboard

Users who posted comments:

faiek (2); JohnDG (1); jovan (1); mjb1962853 (2); rcapper (1)

Previous in Forum: File Downloads - Under the Hood   Next in Forum: Windows XP Screensaver Problem

Advertisement