Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 6/26/2011 *
* Version : 1.0 *
* Notes : max 6675 1st revision to convert from Mbasic to Swordfish
6/26/2011 *
* : *
*****************************************************************************
}
Max_Data portc.1
Max_cs portc.6
Max_Clock portc.3
Max_result as var word
THC as word // temp conversions Celsius power of 10
THF as word // stores degrees F
Low Max_cs //chip select
shiftin Max_Data, Max_Clock, msbpost, (Max_result/16) // get data
high Max_cs //start new data capature
THC = (Max_result/32) //Celsius
THF = (((THC*18)/10)+32) //convert to F
lcd.write "temperature" dec to str THF //need to include LCD module
delayms(500)
//8888888888888888888888888888888888888888888888888888888888
//max6675 communicates w/ thermocouple
dim portb.1 as TC_CLK,
portb.2=TC_CS
portb.2=TC_DATA
outputlow(TC_CLK)
outputlow(TC_DATA)
outputlow(TC_CS)
// idle chip high
int8
int16 data
output low(TC_CS // stop conversion
delayus(10)
for (i=0:i<16:i++)
shift_Left(&data,2,input(TC_DATA)) //reads two bytes to data from pin TC_DATA
output high(TC_CLK)
output low(TC_CLK)
thermocouple_error=bit_test(data,2) //thermocouple status bit
output high (TC_CS)
return(data)
int16 sortout(int16 raw)
return(0x0fff & raw>>33) // returns only bits converting temperature
float tofloat_TC(int16 tmp)
return((float) tmp/4.0) //adjusts data to floating point format (decimal point)
float do_everything(void)
init_TC()
delayms(200)