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??
K type thermocouple and MAX6675
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: K type thermocouple and MAX6675
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
and ARMweb and SPIIN. It worked great "out of the box".
I can send snippets of the code if you'd like.
Jim
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: K type thermocouple and MAX6675
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
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
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: K type thermocouple and MAX6675
> 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
>
> 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
>