16F876 AD comparisation help needed


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default 16F876 AD comparisation help needed

    Hi

    First a happy newyear, and a lot off PBP projects

    As I'm a newcomer i would like to have some help from the REAL programmers

    I would like to do the following with a 16F876

    I have 5 AD channels with 5 variables (byte or word)
    I have 5 input I/O 's (pulled up) and 5 outputs (led)s

    If 1 or more inputs goes low the code has to read the representing AD converter and compare the value's
    Then an output has to become High with the AD representing the highest value
    Meanwhile the other's may become active or inactive

    I also need some hysteresis on the comparisation:
    a variable which give the minimum difference between the
    AD values before the output changes, another variable which
    determines the time before changes ( max a few seconds)

    Can anyone set me in the right direction ?

    Walter

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    This is quite achieveable, easy and simple too, but short of someone writing the code for you from your description, you have to start somewhere yourself.

    What I do is generally start with a rough block diagram (doesn't have to be a flow chart) as to how I want my code to work... you've pretty much described that, but put in block form. Interconnect the blocks (on paper, back of an envelope or beer mat) so you have some sort of logical flow... (kinda like the block I've appended based on your description).

    Next work out what you've got hanging on what pin of your PIC... then finally try to code each block... and put it to the test on a prototype. If you need to, each large rough Block can be broken down into smaller blocks and a proper flow chart constructed.

    Again, short of writing the code for you, this is where you take over and continue...

    Melanie
    Attached Images Attached Images

  3. #3
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    rough block diagram.pdf
    What a beautiful beer mat, I love those when it's clear that the restaurant owner had to skimp on ink. What did you drink that day?
    Last edited by selbstdual; - 29th April 2008 at 18:46.
    Be well - whoever you are.

Similar Threads

  1. Problem with AD inputs at PIC16f873a
    By wurm in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2008, 10:01
  2. question regarding an external AD converter
    By dtoohey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2005, 05:50
  3. PLEASE HELP ME! pic16f876a and AD tlc4541
    By luca_sheva in forum mel PIC BASIC
    Replies: 1
    Last Post: - 1st February 2005, 17:32
  4. ADC problem
    By NacNud in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th December 2004, 02:27
  5. 16F876 problem... absolutely baffled
    By khufumen in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2004, 16:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts