Page 1 of 1

K type thermocouple and MAX6675

Posted: Tue Feb 12, 2013 1:47 pm
by YahooArchive
using a maxim 6675 cold junction converter to read a k type thermocouple
uses 3 pins so (serial out) , sck (serial clock),cs (chip select). is the spin
function where i should be trying or trying to control the pins separately??

Re: K type thermocouple and MAX6675

Posted: Tue Feb 12, 2013 1:48 pm
by YahooArchive
You are on the right track. I recently implemented k-type TC using Maxim 6675
and ARMweb and SPIIN. It worked great "out of the box".

I can send snippets of the code if you'd like.

Jim

Re: K type thermocouple and MAX6675

Posted: Tue Feb 12, 2013 2:22 pm
by YahooArchive
here is the code i am using to read a k type thermocouple converter
MAX31855 . i get only one reading . shouldn't the return loop this around until
incount is completed??


#include
DIM a$ AS INTEGER
a$= RXD1

FUNCTION Fpu_ReadWord

SPIIN(13, 0, 14, 0, 0, 0, a$,10, a$)
print a$
return (a$(0)<<100) + a$(1)

END FUNCTION

Re: K type thermocouple and MAX6675

Posted: Tue Feb 12, 2013 2:57 pm
by YahooArchive
> here is the code i am using to read a k type thermocouple converter
> MAX31855 . i get only one reading . shouldn't the return loop this around
until incount is completed??
>

The short answer is no.

I'll annotate the details below
>
> #include
> DIM a$ AS INTEGER

Hmm, the compiler should probably flag this as an error, as A$ would normally
imply a string, but you are trying to say its an INTEGER or a 32 bit quantity.

> a$= RXD1
>

If a character came into UART1, after the reset (unlikely) it would be in RXD1,
otherwise that would return -1

so if its a string a$ probably is "-1" now, or just -1 if its an integer.

>
> FUNCTION Fpu_ReadWord

You're trying to execute a FUNCTION inline which will break down below

>
> SPIIN(13, 0, 14, 0, 0, 0, a$,10, a$)

This is saying CS is on pin 13, IN and OUT on pin 0, which may be OK, and 14 is
the CLK pin. As of this point you are going to send 2 characters out the SPI
(probably not what you want), those characters being - and 1

> print a$
> return (a$(0)<<100) + a$(1)
>

Executing a RETURN inline may just exit, crash or show a DATA Abort, not what
you really wanted.

>
> END FUNCTION
>