PORTA.4 as analog input


Closed Thread
Results 1 to 22 of 22

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    You're still not giving the whole picture.

    OK... so one end of your signal (let's call it the positive end) is connected to 13.1, but what is the other side of your signal connected to? Is it 13.2?

    If it's not connected to 13.2, then where is it connected?

    What is plugged into 13.2?

    What is this signal we are talking about from?

    Let's have the whole thing, not a pile of sockets where we are guessing what may or may not be connected properly.

  2. #2
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    Hi,

    The signal is a output voltage form a sensor and it is connected to the ECU (engine control unit) that will pulsing the fuel injector. The pic is always monitoring the signal (on portA.4) and under some situation it will overwrite the signal that the sensor send to ECU by switching on the relay; the pic will PWM on PortB.3 to send the voltage to ECU.

    Hope this will make the thing clearer.

    Thanks!

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


    Did you find this post helpful? Yes | No

    Default

    Try this...

    1. Unplug PIC from board.
    2. Measure volts on socket at RA4. You should have what you expect to see from your sensor. This signal should be the same at RA4, J3.1 and J3.2. If it isn't, you have a problem.

    3. Plug PIC back into board... voltage at RA4 should be what you had before. This signal should be the same at J3.1

    If there is a difference between the PIC being plugged-in or not, then...

    A. The PICs software is not configured for INPUT proprerly
    B. There is a defect with the PIC
    C. The Sensor is defective or otherwise has insufficient drive for the PIC.

    I have assumed that the Return for the Sensor is part of the Engine GROUND, and you have also connected 0v on your board to Engine GROUND.

  4. #4
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default O2's are high impedance

    My suspicions to the problem is "A" and "C", definitely "C".
    kblim, you need to buffer the O2 sensor output signal before sending it to the PIC. This keeps it from loading it down as you have seen when it almost worked on RA7 and RB2. I've provided an old circuit that I used back in the day of playing around with injector PW modification. It's basically the same thing you are doing but I used a pot where you want to use the PIC (before my eyes were opened ).
    Good luck on the original RA4 "short to ground" problem.
    Attached Images Attached Images  
    Louie

  5. #5
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Smile

    Hi LinkMTech,
    thanks for your help. I will try it out, but if you can provide me the simple schematic or guidance to setup the op-amps without offsetting the voltage, that will be good. I'm not familiar with the op-amps... Thanks again.


    Another problem i'm facing now is the ADC to measure some small voltage drop in the low ohmic resistor (for current sensing).

    A low ohmic resistor will be connected serially with the 13.8V on the left and a Load (RL) on the other end. When in operation mode, some voltage dropped (Vi) in the low ohmic resistor and the ADC will pickup Vi and convert into the current reading. The question are:

    1. How do i setup the ADC to measure the Vi. The source is 13.8V, but pic is powered by 5V in my design.

    2. The PIC is configured in VREF+ = AVDD, VREF- = AVSS to measure others voltage reading, what do i need to change for the VREF in order to measure Vi.

    Thanks! Really appreciate your help.

    .

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    KBLIM, in the attached schematic there are two suggestions for your project:

    First suggestion: Modify the relay driver, in your shematic the base current is the collector current. The base of the PNP transistor should be polarized (pulledup) and the base current limited with a resistor. I don't think these two transistors will last long wired as per your schematic.

    Second suggestion: How to solve, in a simple way, your current reading problem.

    Al.
    Attached Images Attached Images  
    All progress began with an idea

  7. #7
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    Thank you, aratti.

    Really appreciate your suggestion 1 and 2. Your suggestion one really help me to protect my resistor and the opto couple.

    However please forgive me because didn't give the connection on low ohmic resistor to measure Vi. Because of the site condition, the resistor must be connected between the positive source and the load.

    13.8V 0-------------^^^Vi^^^------------====Load=====-------------0 0V

    Therefore the suggestion 2 is not suitable for my case. The 0V will not be suitable to be my Vref- in the ADC configuration. Just wonder how :

    1. How do i setup the ADC to measure the Vi. The source is 13.8V, but pic is powered by 5V in my design.

    2. The PIC is configured in VREF+ = AVDD, VREF- = AVSS to measure others voltage reading, what do i need to change for the VREF in order to measure Vi.


    Again very thank you to aratti!

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. Analog input on 18f252
    By kiteman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th January 2009, 08:34
  3. Analog Input on PIC16F88
    By penelopepug in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th May 2008, 22:49
  4. 16f88 - pin RA4 as analog input
    By savnik in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 15th December 2006, 13:55
  5. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32

Members who have read this thread : 0

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