 |
 |
| View previous topic :: View next topic |
| Author |
Message |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Aug 09, 2011 3:22 pm |
|
|
quoting:
The LTC2480 contains an on-chip PTAT (proportional to
absolute temperature) signal that can be used as a temperature
sensor. The internal PTAT has a typical value of 420mV
at 27°C
since the gain is preset in this mode
you use :
420/(27 + 273) = 1.40mV/°C (SLOPE)
then plug in to
to the formula block you quoted above.
and if was just trying to KNOW if my circuitry was OK -
i would use that TWO wire - CS -LOW SDI LOW (full time ))
configuration mentioned in the datasheet
and simply read conversions from a potentiometer or
whatever - until i knew that i was reading data properly
to that end as i quoted before :
HOLD the serial data input (SDI) and CS low.
In this default mode, the measured input is external, ( +,-) the
GAIN is 1, the digital filter simultaneously rejects 50Hz
and 60Hz line frequency noise, and the speed mode is 1
the data as you clock it in SHOULD BE be:
- first BYTE received in this bit order
!EOC,DMY,SIG,CON_RES_BIT,D15,D14,D13,D12,
The leading 4 bits in byte one should be 0,0,1,0
but i would just mask and ignore them in testing
-SECOND BYTE IS
D11,D10,D9,D8,D7,D6,D5,D4,
-THIRD BYTE
D3,D2,D1,D0,GS2,GS1,GS0,IM
IN THE @ WIRE MODE I SUGGEST
GD0,1,2 are all=0 IM=0
i have to say the data format is a real PITA too
as you have to jerk around to get a clean 16 bit value from this mess of
data input -
actually ------------
i still view this whole chip as real PITA - one that i would avoid like the plague unless being paid by the hour to sort it out ;-))
then i would LOVE it
it is ALL doable - but you chose it - not me
normally i would use the LM34 ( not the M35) with a 2.5v ext reference, even IF the goal was data in degrees C- preferring to use the extra span resolution of -the LM34 - and calculate degrees C if the application requires it .
----------------
best o luck
[/i] |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 09, 2011 4:26 pm |
|
|
Try this test program. It should display the raw data from the temperature
sensor. I set it up to display on a terminal window, not the lcd. That
makes it easier for you to get 10 lines of raw data and then copy and
paste it into a post. This assumes your PIC board has RS232 output
capability. If you post the raw temperature data, then we can look at it
and run their formula on it, and see if the chip is working.
| Code: |
#include <16F628A.H>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4M)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, ERRORS)
#define PIC_SCK PIN_A0
#define PIC_SDO PIN_A1
#define PIC_SDI PIN_A7
#define PIC_CS PIN_A6
#use spi(MASTER, MODE=0, CLK=PIC_SCK, DO=PIC_SDO, DI=PIC_SDI, BITS=8, MSB_FIRST)
#define LTC2480_READ_TEMP_CMD 0x88
//-----------------------------------------------
int32 ltc2480_read_raw_word(int8 command)
{
int8 lsb, mid, msb;
int32 retval;
output_low(PIC_CS);
while(input(PIC_SDI)); // Wait here until SDI = 0. Then continue.
msb = spi_xfer(command);
mid = spi_xfer(0);
lsb = spi_xfer(0);
output_high(PIC_CS);
retval = make32(0, msb, mid, lsb);
return(retval);
}
//==========================================
void main()
{
int32 raw_temp = 0;
output_high(PIC_CS);
output_low(PIC_SDO);
output_low(PIC_SCK);
delay_ms(500);
while(1)
{
raw_temp = ltc2480_read_raw_word(LTC2480_READ_TEMP_CMD);
printf("%lx \n\r", raw_temp);
delay_ms(500);
}
}
|
|
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Tue Aug 09, 2011 4:51 pm |
|
|
HI PCM,
Thanks so much.
Unfortunately I do not currently have RS232 capability - I should be able to do it though with a bit of fiddling - I will try tomorrow and get back to you. |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Tue Aug 09, 2011 4:57 pm |
|
|
Oh what should I declare 'command' as?
| Code: |
int32 ltc2480_read_raw_word(int8 command) |
and
| Code: |
msb = spi_xfer(command);
|
|
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 09, 2011 6:04 pm |
|
|
It's passed as a parameter to the function when it's called in main().
The program is done. You don't have to do anything. |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Wed Aug 10, 2011 3:40 am |
|
|
OK,
Here is the output on the hyperterminal (which is a snippet of continous output):
00372a21
002b5601
003d2c01
0029f501
003b1a01
002bcaa1
002b9f21
005c42a1
005c9a81
00298ec1
0024c101
00510b01
002af981
005d12a1
00579c01
002dbc61
002c2cc1
003ba5a1
002a2821
005b2901
004a1f21
0033d561
002c9e41
0056b161
0059f601
0034d701
004b0fa1
002e1741
0055cfa1
002aea81
0029cec1
003300e1
002ca641
00574fc1
002ec161
005dab41
I connected and disconnected a few times. Here it is again:
002710c1
002b5501
004c67c1
002cc9e1
002b7c81
00579c21
002b1821
005e4fa1
002ccd81
005e3da1
003b52e1
002bade1
002e0a81
00334981
002c26c1
00332521
002951c1
0035f2c1
002ac2c1
002ce8c1
002fa181
00317541
0058b521 |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Wed Aug 10, 2011 5:05 am |
|
|
Hi PCM.
I then also tested at 35C and at 0C as follows:
35C
003ec821
0051dbc1
004eb341
0040e1c1
0036b301
00263de1
0038f441
003e7301
00600001
00558f41
003f3001
003147a1
001fffe1
002dbe61
0040a101
00549081
00592e41
0041e421
00368421
001fffe1
002ad5a1
00416ac1
0C
004203c1
0032b2a1
00385981
003fdea1
003c2121
00389c01
003d5861
003fa581
003fdb01
00413d41
00387421
00437ea1
00600001
004e4f01
0053b9c1
004e3e61
0049f7c1
004438c1
00433841
003f06a1
00354441
0034ba21
I can't see any pattern really.
Carl |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Wed Aug 10, 2011 5:28 am |
|
|
Just to see - I then swapped the pins around into the RS232 Hardware - so Tx is now Rx and Rx is now Tx. I thought I wouildn't get anything out on the hyperterminal - but this is what I got:
005e97c1
005afde1
0039d281
005b0e01
002d2f01
002fc1c1
004ef181
005a5841
00387ec1
00502b21
005d9b41
00587da1
00357b41
005844c1
002b1421
002c6e41
004f8641
0031c381
0056b961
0050f901
00572f81
005db041
005b2741
So what do you make of all this?
I know that the RS232 'hardware setup' that I am using is correct -because I tried it with something else that works correctly - so it is not how I am testing it.
Carl |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 10, 2011 12:14 pm |
|
|
I think those numbers are too large.
| Quote: |
I then swapped the pins around into the RS232 Hardware - so Tx is now
Rx and Rx is now Tx. I thought I wouldn't get anything out on the
hyperterminal - but this is what I got:
005e97c1
005afde1
0039d281
|
I don't understand what you have done here. I don't know what you
mean by "swapped the pins". Did you unsolder the wires going to the
Rx and Tx pins on the PIC, from the Max232 ? And then swap them
and resolder them ? Without changing the program in any way ?
And then it still provided output ? How can that possibly work ?
I mean, this potentially invalidates your whole test.
I feel like I want to give up on this. I think it's pointless for me to
continue. I believe that if I had an LTC2480 on my bench, I could
probably make it work in one hour or less. These posts going back
and forth are just not doing it. |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Wed Aug 10, 2011 1:29 pm |
|
|
Yes that what I meant (I wanted to make sure that it wasn't the RS232 set-up) - I swapped the wires going into the max without changing the program - but after a very short time it started giving out gibberish - so please ignore that point.
As for the figures - they are too big, but thats what I got.
what would you suggest next - I have some spare - so I could change it and try again - but I doubt it would make a difference. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 10, 2011 1:38 pm |
|
|
| Yes, certainly try a new chip. |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Wed Aug 10, 2011 2:03 pm |
|
|
OK,
Thanks for all your help - I will persevere... |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Fri Aug 19, 2011 2:04 am |
|
|
Hi PCM,
I have made considerable progress and just need that last bit of help to complete this ADC issue.
The problem was with the CCS 'MODE' configuration - exactly like a previous post you were involved in here:
http://www.ccsinfo.com/forum/viewtopic.php?t=45741
I was getting the same thing because the timing was 'out' However by changing the code manually from 'mode=0' to IDLE=0, SAMPLE_RISE, it did the trick.
The ADC is now functioning correctly.
But I am scratching my head over a common problem/question that I am having with this ADC. I hope it's an easy answer for you.
THE PROBLEM IS TAHT I AM ONLY GETTING HALF THE USUABLE INPUT RANGE (2.5V PK/PK) INSTEAD OF 5V PK/PK
Usaully with differential ADC's the common mode input is related to VREF, but not with this ADC - the comon mode input Vincm is rail to rail. The FS differential input range +VIN (-) -VIN is explained and discussed in several sections of the datasheet. I have re-read every part of that datasheet and unless I am wrong the following conditions below should allow a 5V pk/pk inputy range = +/- 2.5V:
Gain = 1
Vcc = 5V
Vref = 5V
+Vin = 5V (tied to Vcc)
-Vin = 0V (Tied to GND)
So the allowable input range should be 5Vpk/pk with a 'x1' programmable gain.
the following extract from the datsheet pg37 even states this
| Quote: | With a reference voltage VREF = 5V,
the LTC2480 has a full-scale differential input range of
5V peak-to-peak |
But I am not getting this - my input range is only half - 2.5V pk/kp.
Any help would be appreciated. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20159
|
|
Posted: Fri Aug 19, 2011 2:19 am |
|
|
What is In- connected to?.
The input range, is -0.5*Vref to *0.5*Vref, between in+, and in- (with unity gain selected).
To get the full 5v range on In+, you need to connect In- to 2.5v.
Best Wishes |
|
 |
carl
Joined: 06 Feb 2008 Posts: 240 Location: Chester
|
|
Posted: Fri Aug 19, 2011 3:21 am |
|
|
Hi Ttelmah,
That answers it, i understand. I will try it and see.
How will this effect a differential signal though from the load cell?
The load cell is powered from 5V giving a common mode for the load cell of 2.5V for In+ and In- . At no load the voltage difference is '0' at max load the FS is 7.5mV or +/- 3.75mV.
So In- = 2.49625V
In+ = 2.50375V
Now looking again at the datasheet | Quote: |
Table 2a. The LTC2480 Performance vs GAIN in Normal Speed Mode (VCC = 5V, VREF = 5V)
GAIN 1 4 8 16 32 64 128 256 Input Span ±2.5 ±0.625 ±0.312 ±0.156 ±78m ±39m ±19.5m ±9.76m V |
with a gain of 256, I should be able to get an input range of 2.5V±9.76mV = 65535 output . But I am nearly 52295 with a ±3.75mV input (which is a bit high but you get he idea - the load cell is damaged so the results are not exact). In other words it is like it is only reading half the scale
What do you think?
Thanks
Carl |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|