![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A program to measure the temperature using the Max6675 board. The temperature is shown on 8x8 Max7219 matrix display and it is saved on SD as well.
Dependencies: MAX7219 SDFileSystem mbed
Fork of MAXREFDES99_demo by
The program measures the temperature using the Max6675 board designed for Arduino. The temperature is shown on Max7219 8x8 matrix display (designed for Arduino as well) as text marque from right to left. The fonf size is 5x7 so the last row is used to show some info:
- All leds off: Normal temperature measuring - Leds shifting: Saving on SD card - Leds blinking: SD card missing or damaged
The Blue "user button" is used to save measured temperature on SD card. First click start saving, the second stop the process. Together the temperature is saved also the time. The time is reset when the process start. Connecting the USB to PC it's possible to see instant temperature and all saved data on SD.
Diff: maxrefdes99.cpp
- Revision:
- 12:1bd4a9f09a8d
- Parent:
- 9:3c6d6c856e3d
--- a/maxrefdes99.cpp Tue May 31 22:21:07 2016 +0000 +++ b/maxrefdes99.cpp Thu Oct 04 11:37:43 2018 +0000 @@ -1,137 +1,103 @@ -/******************************************************************//** -* @file maxrefdes99.cpp -* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES -* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Maxim Integrated -* Products, Inc. shall not be used except as stated in the Maxim Integrated -* Products, Inc. Branding Policy. -* -* The mere transfer of this software does not imply any licenses -* of trade secrets, proprietary technology, copyrights, patents, -* trademarks, maskwork rights, or any other form of intellectual -* property whatsoever. Maxim Integrated Products, Inc. retains all -* ownership rights. -**********************************************************************/ - #include "maxrefdes99.h" - //5x7 character bit map static const uint8_t font_5x7[95][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //SPACE - {0x00, 0x00, 0x00, 0xf2, 0x00, 0x00}, //! - {0x00, 0x00, 0xe0, 0x00, 0xe0, 0x00}, //" - {0x00, 0x28, 0xfe, 0x28, 0xfe, 0x28}, //# - {0x00, 0x24, 0x54, 0xfe, 0x54, 0x48}, //$ - {0x00, 0xc4, 0xc8, 0x10, 0x26, 0x46}, //% - {0x00, 0x6c, 0x92, 0xaa, 0x44, 0x0a}, //& - {0x00, 0x00, 0xa0, 0xc0, 0x00, 0x00}, //' - {0x00, 0x00, 0x38, 0x44, 0x82, 0x00}, //( - {0x00, 0x00, 0x82, 0x44, 0x38, 0x00}, //) - {0x00, 0x28, 0x10, 0x7c, 0x10, 0x28}, //* - {0x00, 0x10, 0x10, 0x7c, 0x10, 0x10}, //+ - {0x00, 0x00, 0x0a, 0x0c, 0x00, 0x00}, //, - {0x00, 0x10, 0x10, 0x10, 0x10, 0x10}, //- - {0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, //. - {0x00, 0x04, 0x08, 0x10, 0x20, 0x40}, /// - {0x00, 0x7c, 0x8a, 0x92, 0xa2, 0x7c}, //0 - {0x00, 0x00, 0x42, 0xfe, 0x02, 0x00}, //1 - {0x00, 0x42, 0x86, 0x8a, 0x92, 0x62}, //2 - {0x00, 0x84, 0x82, 0xa2, 0xd2, 0x8c}, //3 - {0x00, 0x18, 0x28, 0x48, 0xfe, 0x08}, //4 - {0x00, 0xe4, 0xa2, 0xa2, 0xa2, 0x9c}, //5 - {0x00, 0x3c, 0x52, 0x92, 0x92, 0x0c}, //6 - {0x00, 0x80, 0x8e, 0x90, 0xa0, 0xc0}, //7 - {0x00, 0x6c, 0x92, 0x92, 0x92, 0x6c}, //8 - {0x00, 0x60, 0x92, 0x92, 0x94, 0x78}, //9 - {0x00, 0x6c, 0x6c, 0x00, 0x00, 0x00}, //: - {0x00, 0x6a, 0x6c, 0x00, 0x00, 0x00}, //; - {0x00, 0x10, 0x28, 0x44, 0x82, 0x00}, //< - {0x00, 0x28, 0x28, 0x28, 0x28, 0x28}, //= - {0x00, 0x00, 0x82, 0x44, 0x28, 0x10}, //> - {0x00, 0x40, 0x80, 0x8a, 0x90, 0x60}, //? - {0x00, 0x0c, 0x92, 0x9e, 0x82, 0x7c}, //@ - {0x00, 0x7e, 0x88, 0x88, 0x88, 0x7e}, //A - {0x00, 0xfe, 0x92, 0x92, 0x92, 0x6c}, //B - {0x00, 0x7c, 0x82, 0x82, 0x82, 0x44}, //C - {0x00, 0xfe, 0x82, 0x82, 0x44, 0x38}, //D - {0x00, 0xfe, 0x92, 0x92, 0x92, 0x82}, //E - {0x00, 0xfe, 0x90, 0x90, 0x90, 0x80}, //F - {0x00, 0x7c, 0x82, 0x92, 0x92, 0x5e}, //G - {0x00, 0xfe, 0x10, 0x10, 0x10, 0xfe}, //H - {0x00, 0x00, 0x82, 0xfe, 0x82, 0x00}, //I - {0x00, 0x04, 0x02, 0x82, 0xfc, 0x80}, //J - {0x00, 0xfe, 0x10, 0x28, 0x44, 0x82}, //K - {0x00, 0xfe, 0x02, 0x02, 0x02, 0x02}, //L - {0x00, 0xfe, 0x40, 0x30, 0x40, 0xfe}, //M - {0x00, 0xfe, 0x20, 0x10, 0x08, 0xfe}, //N - {0x00, 0x7c, 0x82, 0x82, 0x82, 0x7c}, //O - {0x00, 0xfe, 0x90, 0x90, 0x90, 0x60}, //P - {0x00, 0x7c, 0x82, 0x8a, 0x84, 0x7a}, //Q - {0x00, 0xfe, 0x90, 0x98, 0x94, 0x62}, //R - {0x00, 0x62, 0x92, 0x92, 0x92, 0x8c}, //S - {0x00, 0x80, 0x80, 0xfe, 0x80, 0x80}, //T - {0x00, 0xfc, 0x02, 0x02, 0x02, 0xfc}, //U - {0x00, 0xf8, 0x04, 0x02, 0x04, 0xf8}, //V - {0x00, 0xfc, 0x02, 0x0c, 0x02, 0xfc}, //W - {0x00, 0xc6, 0x28, 0x10, 0x28, 0xc6}, //X - {0x00, 0xe0, 0x10, 0x0e, 0x10, 0xe0}, //Y - {0x00, 0x86, 0x8a, 0x92, 0xa2, 0xc2}, //Z - {0x00, 0x00, 0xfe, 0x82, 0x82, 0x00}, //[ - {0x00, 0x40, 0x20, 0x10, 0x08, 0x04}, //backslash - {0x00, 0x00, 0x82, 0x82, 0xfe, 0x00}, //] - {0x00, 0x20, 0x40, 0x80, 0x40, 0x20}, //^ - {0x00, 0x02, 0x02, 0x02, 0x02, 0x02}, //_ - {0x00, 0x00, 0x80, 0x40, 0x20, 0x00}, //` - {0x00, 0x04, 0x2a, 0x2a, 0x2a, 0x1e}, //a - {0x00, 0xfe, 0x0a, 0x12, 0x12, 0x0c}, //b - {0x00, 0x1c, 0x22, 0x22, 0x22, 0x04}, //c - {0x00, 0x1c, 0x22, 0x22, 0x12, 0xfe}, //d - {0x00, 0x1c, 0x2a, 0x2a, 0x2a, 0x18}, //e - {0x00, 0x10, 0x7e, 0x90, 0x80, 0x40}, //f - {0x00, 0x30, 0x4a, 0x4a, 0x4a, 0x7c}, //g - {0x00, 0xfe, 0x10, 0x20, 0x20, 0x1e}, //h - {0x00, 0x00, 0x22, 0xbe, 0x02, 0x00}, //i - {0x00, 0x04, 0x02, 0x22, 0xbc, 0x00}, //j - {0x00, 0xfe, 0x08, 0x14, 0x22, 0x00}, //k - {0x00, 0x00, 0x82, 0xfe, 0x02, 0x00}, //l - {0x00, 0x1e, 0x20, 0x1a, 0x22, 0x1e}, //m - {0x00, 0x3e, 0x10, 0x20, 0x20, 0x1e}, //n - {0x00, 0x1c, 0x22, 0x22, 0x22, 0x1c}, //o - {0x00, 0x3e, 0x28, 0x28, 0x28, 0x10}, //p - {0x00, 0x10, 0x28, 0x28, 0x18, 0x3e}, //q - {0x00, 0x3e, 0x10, 0x20, 0x20, 0x10}, //r - {0x00, 0x12, 0x2a, 0x2a, 0x2a, 0x04}, //s - {0x00, 0x20, 0xfc, 0x22, 0x02, 0x04}, //t - {0x00, 0x3c, 0x02, 0x02, 0x04, 0x3e}, //u - {0x00, 0x38, 0x04, 0x02, 0x04, 0x38}, //v - {0x00, 0x3c, 0x02, 0x0c, 0x02, 0x3c}, //w - {0x00, 0x22, 0x14, 0x08, 0x14, 0x22}, //x - {0x00, 0x30, 0x0a, 0x0a, 0x0a, 0x3c}, //y - {0x00, 0x22, 0x26, 0x2a, 0x32, 0x22}, //z - {0x00, 0x00, 0x10, 0x6c, 0x82, 0x00}, //{ - {0x00, 0x00, 0x00, 0xfe, 0x00, 0x00}, //| - {0x00, 0x00, 0x82, 0x6c, 0x10, 0x00}, //} - {0x00, 0x30, 0x40, 0x30, 0x08, 0x30} //~ + {0x00,0x00,0x00,0x00,0x00,0x00}, //SPACE + {0x00,0x00,0xf2,0x00,0x00,0x00}, //! + {0x00,0xe0,0x00,0xe0,0x00,0x00}, //" + {0x28,0xfe,0x28,0xfe,0x28,0x00}, //# + {0x48,0x54,0xfe,0x54,0x24,0x00}, //$ + {0x46,0x26,0x10,0xc8,0xc4,0x00}, //% + {0x0a,0x44,0xaa,0x92,0x6c,0x00}, //& + {0x00,0x00,0xc0,0xa0,0x00,0x00}, //' + {0x00,0x82,0x44,0x38,0x00,0x00}, //( + {0x00,0x38,0x44,0x82,0x00,0x00}, //) + {0x28,0x10,0x7c,0x10,0x28,0x00}, //* + {0x10,0x10,0x7c,0x10,0x10,0x00}, //+ + {0x00,0x00,0x0c,0x0a,0x00,0x00}, // + {0x10,0x10,0x10,0x10,0x10,0x00}, //- + {0x00,0x00,0x06,0x06,0x00,0x00}, //. + {0x40,0x20,0x10,0x08,0x04,0x00}, /// + {0x7c,0xa2,0x92,0x8a,0x7c,0x00}, //0 + {0x00,0x02,0xfe,0x42,0x00,0x00}, //1 + {0x62,0x92,0x8a,0x86,0x42,0x00}, //2 + {0x8c,0xd2,0xa2,0x82,0x84,0x00}, //3 + {0x08,0xfe,0x48,0x28,0x18,0x00}, //4 + {0x9c,0xa2,0xa2,0xa2,0xe4,0x00}, //5 + {0x0c,0x92,0x92,0x52,0x3c,0x00}, //6 + {0xc0,0xa0,0x90,0x8e,0x80,0x00}, //7 + {0x6c,0x92,0x92,0x92,0x6c,0x00}, //8 + {0x78,0x94,0x92,0x92,0x60,0x00}, //9 + {0x00,0x00,0x00,0x6c,0x6c,0x00}, //: + {0x00,0x00,0x00,0x6c,0x6a,0x00}, //; + {0x00,0x82,0x44,0x28,0x10,0x00}, //< + {0x28,0x28,0x28,0x28,0x28,0x00}, //= + {0x10,0x28,0x44,0x82,0x00,0x00}, //> + {0x60,0x90,0x8a,0x80,0x40,0x00}, //? + {0x7c,0x82,0x9e,0x92,0x0c,0x00}, //@ + {0x7e,0x88,0x88,0x88,0x7e,0x00}, //A + {0x6c,0x92,0x92,0x92,0xfe,0x00}, //B + {0x44,0x82,0x82,0x82,0x7c,0x00}, //C + {0x38,0x44,0x82,0x82,0xfe,0x00}, //D + {0x82,0x92,0x92,0x92,0xfe,0x00}, //E + {0x80,0x90,0x90,0x90,0xfe,0x00}, //F + {0x5e,0x92,0x92,0x82,0x7c,0x00}, //G + {0xfe,0x10,0x10,0x10,0xfe,0x00}, //H + {0x00,0x82,0xfe,0x82,0x00,0x00}, //I + {0x80,0xfc,0x82,0x02,0x04,0x00}, //J + {0x82,0x44,0x28,0x10,0xfe,0x00}, //K + {0x02,0x02,0x02,0x02,0xfe,0x00}, //L + {0xfe,0x40,0x30,0x40,0xfe,0x00}, //M + {0xfe,0x08,0x10,0x20,0xfe,0x00}, //N + {0x7c,0x82,0x82,0x82,0x7c,0x00}, //O + {0x60,0x90,0x90,0x90,0xfe,0x00}, //P + {0x7a,0x84,0x8a,0x82,0x7c,0x00}, //Q + {0x62,0x94,0x98,0x90,0xfe,0x00}, //R + {0x8c,0x92,0x92,0x92,0x62,0x00}, //S + {0x80,0x80,0xfe,0x80,0x80,0x00}, //T + {0xfc,0x02,0x02,0x02,0xfc,0x00}, //U + {0xf8,0x04,0x02,0x04,0xf8,0x00}, //V + {0xfc,0x02,0x0c,0x02,0xfc,0x00}, //W + {0xc6,0x28,0x10,0x28,0xc6,0x00}, //X + {0xe0,0x10,0x0e,0x10,0xe0,0x00}, //Y + {0xc2,0xa2,0x92,0x8a,0x86,0x00}, //Z + {0x00,0x82,0x82,0xfe,0x00,0x00}, //[ + {0x04,0x08,0x10,0x20,0x40,0x00}, //backslash + {0x00,0xfe,0x82,0x82,0x00,0x00}, //] + {0xc0,0xc0,0x00,0x00,0x00,0x00}, //° + {0x02,0x02,0x02,0x02,0x02,0x00}, //_ + {0x00,0x20,0x40,0x80,0x00,0x00}, //` + {0x1e,0x2a,0x2a,0x2a,0x04,0x00}, //a + {0x0c,0x12,0x12,0x0a,0xfe,0x00}, //b + {0x04,0x22,0x22,0x22,0x1c,0x00}, //c + {0xfe,0x12,0x22,0x22,0x1c,0x00}, //d + {0x18,0x2a,0x2a,0x2a,0x1c,0x00}, //e + {0x40,0x80,0x90,0x7e,0x10,0x00}, //f + {0x7c,0x4a,0x4a,0x4a,0x30,0x00}, //g + {0x1e,0x20,0x20,0x10,0xfe,0x00}, //h + {0x00,0x02,0xbe,0x22,0x00,0x00}, //i + {0x00,0xbc,0x22,0x02,0x04,0x00}, //j + {0x00,0x22,0x14,0x08,0xfe,0x00}, //k + {0x00,0x02,0xfe,0x82,0x00,0x00}, //l + {0x1e,0x22,0x1a,0x20,0x1e,0x00}, //m + {0x1e,0x20,0x20,0x10,0x3e,0x00}, //n + {0x1c,0x22,0x22,0x22,0x1c,0x00}, //o + {0x10,0x28,0x28,0x28,0x3e,0x00}, //p + {0x3e,0x18,0x28,0x28,0x10,0x00}, //q + {0x10,0x20,0x20,0x10,0x3e,0x00}, //r + {0x04,0x2a,0x2a,0x2a,0x12,0x00}, //s + {0x04,0x02,0x22,0xfc,0x20,0x00}, //t + {0x3e,0x04,0x02,0x02,0x3c,0x00}, //u + {0x38,0x04,0x02,0x04,0x38,0x00}, //v + {0x3c,0x02,0x0c,0x02,0x3c,0x00}, //w + {0x22,0x14,0x08,0x14,0x22,0x00}, //x + {0x3c,0x0a,0x0a,0x0a,0x30,0x00}, //y + {0x22,0x32,0x2a,0x26,0x22,0x00}, //z + {0x00,0x82,0x6c,0x10,0x00,0x00}, // + {0x00,0x00,0xfe,0x00,0x00,0x00}, //| + {0x00,0x10,0x6c,0x82,0x00,0x00}, //} + {0x30,0x08,0x30,0x40,0x30,0x00}, //~ }; @@ -1106,7 +1072,6 @@ }; - static uint8_t display_buff[1024]; static uint8_t display_buff_16x16[32]; static uint16_t buff_end =0; @@ -1204,10 +1169,12 @@ { uint8_t idx = 0; + int Cont=0; + while(s[idx] != '\0') { print_char(p_display, (position + (idx*6)), s[idx]); - idx++; + idx++; } } @@ -1218,7 +1185,7 @@ uint8_t position99; for(idx = 0; idx < count; idx++) - { + { for(idy = 0; idy < (buff_end + 1); idy++) { if(idy == buff_end) @@ -1262,7 +1229,7 @@ p_display->write_digit(3, position99, display_buff[idy]); } else if(position99 > 8) - { + { if(position99 % 8) { position99 = position99 % 8; @@ -1487,6 +1454,7 @@ while(endless_loop); } + //********************************************************************* void endless_scroll_display(Max7219 *display, uint32_t scroll_right) { @@ -1508,6 +1476,7 @@ } } + /********************************************************************/ void get_16x16_character(char c, uint8_t *char_buff, uint8_t font_type) {