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.
Revision 12:1bd4a9f09a8d, committed 2018-10-04
- Comitter:
- lore71
- Date:
- Thu Oct 04 11:37:43 2018 +0000
- Parent:
- 11:61087b036418
- Commit message:
- 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.
Changed in this revision
diff -r 61087b036418 -r 1bd4a9f09a8d SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Thu Oct 04 11:37:43 2018 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/mbed/code/SDFileSystem/#8db0d3b02cec
diff -r 61087b036418 -r 1bd4a9f09a8d main.cpp --- a/main.cpp Tue May 31 22:21:07 2016 +0000 +++ b/main.cpp Thu Oct 04 11:37:43 2018 +0000 @@ -1,158 +1,224 @@ -/*********************************************************************** -* 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. -**********************************************************************/ +// By Lorenzo Cervelli - Sept.2018 +// OK su STM32-F401RE + +#include "mbed.h" + +// Display 8x8 con Max7219 #include "maxrefdes99.h" +// Sensore di temperatura con Max6675 +#include "max6675.h" + +// Per gestire la SD +#include "SDFileSystem.h" + +// Per il pulsante 'on board' +InterruptIn my_button(USER_BUTTON); +bool Btn = 0; + +// Per la SD +FILE *fp; +Serial pc(USBTX, USBRX); + +// Per il tempo di funzionamento (da quando e' alimentato) +Timer t; + +void pressed() // Per il pulsante 'on board' +{ + // Resetto + if (Btn==0) + { + Btn=1; + + // Rimuovo il file precedente + remove("/sd/sdtest.txt"); + wait(1); // Lascio il tempo al file-system + + // Apro il file sulla SD x la scrittura + printf(" OK, writing to SD card... \r\n"); + fp = fopen("/sd/sdtest.txt", "w"); + wait(2); // Lascio il tempo al file-system + + // Faccio partire il tempo + t.start(); + } + else + { + Btn=0; + + // Chiudo il file + fclose(fp); + printf(" OK successfully saved! \r\n"); + + // Lascio il tempo al file-system + wait(1); + + // Fermo il tempo + t.stop(); + + // Leggo tutto il file delle temperature e mostro sulla seriale + int c; + pc.printf("\n Reading from SD card... \r\n"); + pc.printf(" ----- BEGIN ----- \r\n"); + fp = fopen("/sd/sdtest.txt", "r"); + if (fp) + { + while ((c = getc(fp)) != EOF) + pc.putc(c); + fclose(fp); + } + pc.printf(" ----- END ----- \r\n"); + } +} int main(void) -{ - Max7219 display(D11, D12, D13, D10); +{ + // Sensore di temperatura con Max6675 (Morpho Connectors su F401RE) + SPI spi(PC_12, PC_11, PC_10); // MOSI, MISO, SCLK + max6675 max(spi, PA_14); // CS + + // Scheda di memoria SD (Arduino Connectors su F401RE) + SDFileSystem sd(D11, D12, D13, D8, "sd");// MOSI, MISO, SCK, CS + + // Settaggi SPI per 8x8 Led matrix Max7219 (Morpho Connectors su F401RE) + // PB_15 --> DIN (MOSI) + // PB_13 --> CLK (SCK) + // PB_1 --> LOAD (CS) + // PB_14 --> MISO + Max7219 display(PB_15, PB_14, PB_13, PB_1); //struct for holding MAX7219 configuration data max7219_configuration_t display_config; - //configuration data - display_config.decode_mode = 0; //no BCD decode - display_config.intensity = Max7219::MAX7219_INTENSITY_F; //max intensity - display_config.scan_limit = Max7219::MAX7219_SCAN_8; //scan all digits + // MAX7219 configuration data + display_config.decode_mode = 0; // no BCD decode + display_config.intensity = Max7219::MAX7219_INTENSITY_F; // max intensity + display_config.scan_limit = Max7219::MAX7219_SCAN_8; // scan all digits - //set number of MAX7219 devices being used - display.set_num_devices(4); + // MAX7219 set number of MAX7219 devices being used + display.set_num_devices(1); - //config display + // MAX7219 config display display.init_display(display_config); - //ensure all data registers are 0 + // MAX7219 ensure all data registers are 0 display.display_all_off(); - display.enable_display(); - uint32_t user_input = 0,user_font = 0; - uint32_t shift_right; + // MAX7219 variables + uint32_t user_input = 0; char user_char; - char *p_str; + char *p_str; + + // MAX7219 Luminosita' (value from 0 to 15) + display_config.intensity = 5; + display.init_display(display_config); + + // MAX7219 Posizione di partenza (value from 1 to 32) + user_char = 1; + print_char(&display, user_input, user_char); + + // MAX7219 Contatore per utilizzare l'ultima riga della matrice 8x8 + int Cur=1; - while(user_input != 9) - { - user_input = print_menu(); - - switch(user_input) + // Set button 'on board' + my_button.fall(&pressed); + + // Ciclo continuo + while(1) + { + int cnt; + int idx; + + // Leggo la temperatura del Max6675 + float TC = max.read_temp(); + // Lascio il tempo al sensore di temperatura + wait(0.5); + + // Stampo sulla seriale (Temperatura con 2 digits dopo la virgola e Time con 3 digits dopo la virgola) + printf(" Temperature(C): %.2f Time(Sec): %.3f \r\n", TC, t.read()); + + // Scrivo nel file sulla SD + if (Btn==1) { - case 1: - printf("\n 0: For 5x7 font"); - printf("\n 1: For 16x16 Aerial bold font"); - printf("\n 2: For 16x16 Manual font"); - user_font = get_user_input("\nPlease select font: ", 2); - if((user_font == 1) || (user_font == 2)) - printf("\nNote:Position option works only for 5x7 font\n"); - break; - case 2: - user_input = get_user_input("\nPlease enter a value from 0 to 15: ", 15); - printf("\nUpdating display configuration...\n"); - display_config.intensity = user_input; - display.init_display(display_config); - //make sure is good for next loop - user_input = 0; - break; - case 3: - if(user_font == 0) - user_input = get_user_input("\nPlease enter which position, 1 to 32: ", 32); - user_char = get_user_char("\nPlease enter an ASCII character from '0' (zero) to 'z' (0x7A): "); - if(user_font == 0) - print_char(&display, user_input, user_char); - else if(user_font >= 1) - print_char_16x16(&display, 0, user_char, user_font); - //make sure is good for next loop - user_input = 0; - break; - case 4: - if(user_font == 0) - user_input = get_user_input("\nPlease enter which position 1 to 32: ", 32); - p_str = get_user_string("\nPlease enter a string less than 24 characters: "); - if(user_font == 0) - print_string(&display, user_input, p_str); - else if(user_font >=1) - print_string_16x16(&display, p_str, user_font); - //make sure is good for next loop - user_input = 0; - break; - case 5: - if(user_font == 0) - user_input = get_user_input("\nPlease enter number of shifts, 1 to 32: ", 32); - else if(user_font >= 1) - user_input = get_user_input("\nPlease enter number of shifts, 1 to 96: ", 96); - shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right: ", 1); - if(shift_right) - { - printf("\nShifting Display Right %d positions\n", user_input); - if(user_font == 0) - shift_display_right(&display, user_input, 100); - else if(user_font >= 1) - shift_display_right_16x16(&display, user_input, 100); - } - else - { - printf("\nShifting Display Left %d positions\n", user_input); - if(user_font == 0) - shift_display_left(&display, user_input, 100); - else if(user_font >= 1) - shift_display_left_16x16(&display, user_input, 100); - } - break; - case 6: - all_off(&display); - break; - case 7: - printf("\nRunning Demo\n"); - if(user_font==0) - demo(&display, display_config, false); - else if(user_font >= 1) - demo_16x16(&display, display_config, user_font, false); - break; - case 8: - //blocking case, endless loop - shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right: ", 1); - if(user_font == 0) - endless_scroll_display(&display, shift_right); - else if(user_font >= 1) - endless_scroll_display_16x16(&display, shift_right); - break; - case 9: - printf("\nEnding Program\n"); - break; - default: - printf("\nInvalid entry, please try again\n"); - break; + // Scrivo nel file sulla SD + if (fp != NULL) + { + fprintf(fp, "Temperature(C): %.2f Time(Sec): %.3f \r\n", TC, t.read()); + + // Lascio il tempo al file-system + wait(0.1); + + // Accendo i digit dell'ultima riga della matrice in sequenza per far vedere che sto' registrando + if (Cur==1){ display.write_digit(1, 8, 0x01); } // n of matrix, column, byte + if (Cur==2){ display.write_digit(1, 7, 0x01); } // n of matrix, column, byte + if (Cur==3){ display.write_digit(1, 6, 0x01); } // n of matrix, column, byte + if (Cur==4){ display.write_digit(1, 5, 0x01); } // n of matrix, column, byte + if (Cur==5){ display.write_digit(1, 4, 0x01); } // n of matrix, column, byte + if (Cur==6){ display.write_digit(1, 3, 0x01); } // n of matrix, column, byte + if (Cur==7){ display.write_digit(1, 2, 0x01); } // n of matrix, column, byte + if (Cur==8) + { + display.write_digit(1, 1, 0x01); // n of matrix, column, byte + Cur=0; + } + // Incremento il contatore per utilizzare l'ultima riga della matrice 8x8 + Cur++; + } + else + { + int f; + for(f = 0; f <= 9; f++) + { + display.write_digit(1, f, 0x01); + } + + printf(" Write failed! \r\n"); + Btn=0; + } + + // Tempo accensione led + wait(0.5); + + printf(" Press button to stop saving \r\n"); } + else + { + printf(" Press button to save \r\n"); + } + + // Floating to Char + char array[6]; // Numero dei digits (virgola compresa) + snprintf(array, sizeof(array), "%f", TC); + + // Concatenzaione tra Float e String in un nuovo Char + char* Aggiunta="^C "; // NB: Deve finire con 2 spazi alla fine + char dest[sizeof(array)+sizeof(Aggiunta)]; // Size dell'array precedente + size di quello dellaggiunta + strcpy( dest, array ); + strcat( dest, Aggiunta ); + + // Faccio il reverse del testo + size_t l = strlen(dest); + char* r = (char*)malloc((l + 1) * sizeof(char)); + r[l] = '\0'; + int i; + for(i = 0; i < l; i++) + { + r[i] = dest[l - 1 - i]; + } + // Riassegno + p_str = r; + + // Testo nello shift register + print_string(&display, user_input, p_str); + + // Valore per scorrere l'intero testo + cnt=strlen(r)*6; // num char *6 (5 char + 1 space) + for(idx = 0; idx < cnt; idx++) + { + // Scorro la matrice + shift_display_right(&display, 1, 50); + } } - return 0; + } -
diff -r 61087b036418 -r 1bd4a9f09a8d max6675.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/max6675.cpp Thu Oct 04 11:37:43 2018 +0000 @@ -0,0 +1,42 @@ + +#include <mbed.h> +#include "max6675.h" + +max6675::max6675(SPI& _spi, PinName _ncs) : spi(_spi), ncs(_ncs) { + +} + +float max6675::read_temp() { + short value = 0; + float temp = 0; + + uint8_t highByte=0; + uint8_t lowByte=0; + + select(); + wait(.25); //This delay is needed else it does'nt seem to update the temp + + highByte = spi.write(0); + lowByte = spi.write(0); + deselect(); + + + if (lowByte & (1<<2)) { + error("No Probe"); + } else { + value = (highByte << 5 | lowByte>>3); + } + + temp = (value*0.25); // Multiply the value by 0.25 to get temp in ˚C or + // * (9.0/5.0)) + 32.0; // Convert value to ˚F (ensure proper floats!) + +return temp; +} + +void max6675::select() { + ncs = 0; +} + +void max6675::deselect() { + ncs = 1; +}
diff -r 61087b036418 -r 1bd4a9f09a8d max6675.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/max6675.h Thu Oct 04 11:37:43 2018 +0000 @@ -0,0 +1,25 @@ +#ifndef MAX6675_h +#define MAX6675_h + +#include "mbed.h" + +class max6675 +{ + SPI& spi; + DigitalOut ncs; + public: + + max6675(SPI& _spi, PinName _ncs); + void select(); + void deselect(); + + float read_temp(); + private: + PinName _CS_pin; + PinName _SO_pin; + PinName _SCK_pin; + int _units; + float _error; +}; + +#endif
diff -r 61087b036418 -r 1bd4a9f09a8d maxrefdes99.cpp --- 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) {