Author Topic: ADC only displays 4092 reguardless of input voltage.  (Read 13148 times)

Samson

  • Newbie
  • Posts: 4
    • View Profile
ADC only displays 4092 reguardless of input voltage.
« on: March 15, 2006, 05:13:47 PM »
I was testing out the ADC on my T100MD1616+ using a 1k pot and external 5vdc. I grounded to the Analog 0v and used ADC #3.  This is the Custom function im using.

setLCD 2,1,"Deviation  :"+STR$(ADC(3))

Reguardless of what the voltage is at ADC #3 all I get on the display is 4092 and the same with the online monitoring. Is it a error in my programing or could it be a faulty chip on the board?

-Samson

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #1 on: March 16, 2006, 05:32:56 AM »
Go to "Online monitoring", and click view, the ADC values are displayed, what happens when you ground the port or take it to the +5 volt Vref? You should see the extreme values of 0 and 4092. Are you sure the pot is OK?

Samson

  • Newbie
  • Posts: 4
    • View Profile
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #2 on: March 16, 2006, 10:09:57 AM »
I did monitor it with a DMM and could see the voltage going from 0vdc to 4.82vdc

I also tried this program for all ADC inputs (I have a 4x20 LCD)


       1st Scan                               1  FN_#1
---------||--------------------------------{dCusF}



        Clk 0.5s                               2  FN_#2
---------||--------------------------------{dCusF}

FN_#1
setLCD 1,1,"   Watch Dog 100"
setLCD 2,1,"Deviation     :"
setLCD 3,1,"Amperage    :"
setLCD 4,1,"Temperature:"

FN_#2
setLCD 1,15,CHR$(ADC(1))
setLCD 2,15,CHR$(ADC(2))
setLCD 3,15,CHR$(ADC(3))
setLCD 4,15,CHR$(ADC(4))


All I got on the screen is

4092
4092
4092
4092

I tried to ground all without result and tried the pot on all and nothing. It is very bizare. Is there a chip on the board that has just the ADC? Or is the ADC in the main CPU?

-Samson

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #3 on: March 16, 2006, 10:23:04 AM »
I'm kind of a newbie also, but change the DCUSFUN to CUSFUN that will execute every scan. Not sure how the pulses go for that first scan only.

Samson

  • Newbie
  • Posts: 4
    • View Profile
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #4 on: March 16, 2006, 10:58:01 AM »
1st Scan scans the text to the screen only once. Then the ADC inputs are scanned every 1/2 second when the 0.5s closes.

Samson

  • Newbie
  • Posts: 4
    • View Profile
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #5 on: March 16, 2006, 05:29:39 PM »
     Ok I reverse engineered the circuit board. I love doing that, I was having so much fun I got a nose bleed.  Well I discovered that the #1 and #2 0-1v inputs go to a LM324N Quad Op-Amp.

http://www.alliedelec.com/Images/Products/Datasheets/BM/ON_SEMICONDUCTOR/On-Semiconductor_Actives-and-Passives_5684630.pdf

     I set to 1k pot to 1v and traced it to pin 5 and pin 10. I read 1v on each but I read 0v on pins 7 and 8. Must be a bad op amp? Well I will get another tomorrow and hopefully that will work. Any insight on why this would be bad or possibly something I did? I always do an inspection to ensure everything is connected properly before turning the plc on after adding or changing the wiring. Although it has been 8 years since I worked with a plc and it was a 6502 programmed in assembly code. The I/O?s were UART 16550A with 16 byte FIFO, man what a dinosaur.

-Samson

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:ADC only displays 4092 reguardless of input voltage.
« Reply #6 on: March 19, 2006, 03:00:12 AM »
Did you connect the analog power supply to the two terminals meant for that purpose? If you have connected the analog power supply correctly you should be able to get a 5V output from the +5V analog power terminal. Since you have turned the pot the voltage may have been changed and you need to use a DMM to measure the +5V output while turning the AVcc Adj pot until you get a 5V. Without a power supply connected you would get a full scale reading at all the ADC inputs.

You can use the same 24V DC for the PLC digital power supply.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS