![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ESTE MODULO FUNCIONA EN FRDM-KL25Z CON DISPLAY LCD 16X2
Dependencies: MAX31855 TextLCD USBDevice mbed
Fork of LCD_FRDM_KL25Z by
main.cpp
- Committer:
- EDCHEN
- Date:
- 2014-08-26
- Revision:
- 1:ac09ff440ce1
- Parent:
- 0:a6771cc1a056
File content as of revision 1:ac09ff440ce1:
#include "mbed.h" #include "TextLCD.h" #include "USBSerial.h" #include "max31855.h" TextLCD lcd(PTA13, PTD5, PTA4, PTA5, PTC8, PTC9); // rs, e, d4-d7 DigitalOut myled(LED1); //---------------------------------------------------------- //SPI Interfaces SPI testSPI(PTD2,PTD3,PTD1); //---------------------------------------------------------- // USBSerial serial; //---------------------------------------------------------- //Thermocouples max31855 max1(testSPI, PTB18); //---------------------------------------------------------- int main() { //Initialise chip (starts internal timer) max1.initialise(); //Float value to hold temperature returned float fvalue = 0; //----------------------------------------------------------- lcd.cls(); lcd.printf("Welcome\n"); myled = 0; wait(2); lcd.cls(); lcd.locate(0,0); lcd.printf("Set temperaure\n"); // lcd.locate(0,0); // lcd.printf("Current temp"); myled =!myled; wait(2); //--------------------------------------------------------------- while(1) { //Check if the chip is ready for a reading to be taken if (max1.ready()==1) { //Get the reading fvalue = max1.read_temp(); if (fvalue > 2000){ if(fvalue==2001){ //printf("No TC"); lcd.cls(); lcd.locate(0,0); lcd.printf("NO tc"); } else if(fvalue==2002){ // printf("Short to GND"); lcd.cls(); lcd.locate(0,0); lcd.printf("short to GND"); } else if(fvalue==2004){ // printf("Short to VCC"); lcd.cls(); lcd.locate(0,0); lcd.printf("short to VCC"); } } else{ // printf("Temperature is: %f\n\r", fvalue); //lcd.locate(6,0); // lcd.printf((char*)fvalue); lcd.cls(); lcd.locate(0,0); lcd.printf("Current temp"); lcd.locate(0,1); lcd.printf("T=%2.1fC",fvalue); // lcd.printf("T=%f\n\r",fvalue); } } //Heartbeat signal (not necessary) myled = !myled; //Delay is not required, here simply for test program wait(0.25); } }