![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This ih my prototipe program for displaying to vfd Noritake via SC16IS752 (i2c to Serial). for program which i use, i say sorry and you can message me for i publish. thank
Dependencies: Noritake SC16IS752 mbed
Fork of 08_SCT_menu by
Diff: main.cpp
- Revision:
- 1:da53a4d93c33
- Parent:
- 0:51be68b5e97c
--- a/main.cpp Wed Aug 10 03:42:26 2016 +0000 +++ b/main.cpp Fri Aug 12 04:37:13 2016 +0000 @@ -5,45 +5,221 @@ #include "mbed.h" #include "query.h" +#include "Katakata.h" +#include <sstream> +#include <vector> DigitalOut myled(LED1); Serial dbg(USBTX, USBRX); Noritake_VFD_GU7000 vfd(p28, p27); -//uint8_t PGN[8][123] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x31,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x0F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, -// 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x3F,0x7F,0xCE,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,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xF8,0xF0,0xE0,0xC0,0x80,0x80,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xF8,0xF0,0xE0,0xC0,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x1F,0x0F,0x0F,0x0F,0x1F,0x1F,0x7F,0xFF,0xFF,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x78,0xFC,0xFC,0xFC,0xFE,0xFE,0xFE,0xBE,0x3E,0x3E,0x3E,0x3E,0x3E,0x3E,0x1F,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, -// 0x20,0x20,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3E,0x3C,0x3C,0x38,0x38,0x30,0x30,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0F,0x1F,0x07,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3C,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x30,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x30,0x30, -// 0x07,0x07,0x01,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x83,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -// 0xE0,0xF8,0xFE,0x7F,0x3F,0x1F,0x0F,0x07,0x07,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x11,0x7D,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x1D,0x24,0x25,0x18,0x00,0x03,0x1C,0x00,0x00,0x23,0x18,0x00,0x0F,0x01,0x21,0x25,0x1C,0x00,0x07,0x18,0x00,0x20,0x0E,0x11,0x20,0x01,0x13,0x18,0x00,0x18,0x03,0x02,0x08,0x10,0x00,0x00,0x00,0x00,0x3F,0x70,0x80,0x0E,0x11,0x20,0x21,0x32,0x1C,0x00,0x0F,0x10,0x20,0x00,0x00,0x00,0x00,0x0E,0xF0,0x00,0x1E,0x00,0x03,0x3E,0xE0,0x80,0x1F,0x05,0x20,0x21,0x18, -// 0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x20,0x40,0x80,0x00,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - -uint8_t PGN[8][123] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x07,0x19,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0x7F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x3F,0x1F,0x1F,0x0F,0x07,0x07,0x0F,0x1F,0x1E,0x3E,0x3E,0x3E,0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,0x1F,0x3F,0x3E,0x3E,0x3C,0x3C,0x3E,0x3E,0x1F,0x1F,0x0F,0x0F,0x0F,0x0F,0x0F,0x1E,0x1E,0x1E,0x3E,0x3F,0x1F,0x1F,0x1F,0x0F,0x0F,0x07,0x03,0x07,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,0x1F,0x0F,0x0F,0x07,0x01, - 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFE,0xFE,0xFC,0xFC,0xE6,0x07,0x07,0x07,0x03,0x03,0x03,0x01,0x01,0x00,0x00,0x80,0xC0,0xE0,0xF8,0xFC,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xFC,0xFE,0x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xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x03,0x0F,0x0F,0x83,0x81,0xC1,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xE1,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x0E,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xF0,0xF8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0xF0,0xF0,0xF8,0xF8, - 0x03,0x03,0x00,0x40,0xE0,0xF0,0xF8,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC1,0x80,0x01,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFE,0xFC,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xF0,0xF8,0xF8,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0xF8,0xF8,0xF8,0xF0,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xE0,0xFC,0xFF,0x3F,0x1F,0x0F,0x07,0x07,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x08,0xBE,0xFF,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x1A,0x12,0x12,0x0C,0x00,0x03,0x0C,0x10,0x10,0x13,0x0C,0x00,0x07,0x1A,0x12,0x12,0x0C,0x00,0x0F,0x18,0x10,0x00,0x07,0x08,0x10,0x10,0x1F,0x00,0x00,0x0F,0x01,0x01,0x0E,0x00,0x00,0x00,0x00,0x1F,0x32,0x22,0x00,0x07,0x08,0x10,0x10,0x19,0x0E,0x00,0x0F,0x18,0x10,0x00,0x00,0x00,0x03,0x0E,0x70,0x03,0x2E,0x00,0x1F,0x32,0x22,0x00,0x07,0x1A,0x12,0x12,0x0C, - 0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x20,0xA0,0xA0,0xA0,0xC0,0x00,0x00,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00 - }; -int main() +void Display_init() { vfd.GU7000_cursorOff(); vfd.GU7000_clearScreen(); +} + +void Main_Menu() +{ + vector<uint8_t> Vdat; - vfd.GU7000_clearScreen(); - for(int i=0; i<8; i++) + Vdat.insert(Vdat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MMe); i++) + Vdat.push_back((uint8_t) MMe[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Sat); i++) + Vdat.push_back((uint8_t) Sat[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Ent); i++) + Vdat.push_back((uint8_t) Ent[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Dua); i++) + Vdat.push_back((uint8_t) Dua[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Exi); i++) + Vdat.push_back((uint8_t) Exi[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Tig); i++) + Vdat.push_back((uint8_t) Tig[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(SCo); i++) + Vdat.push_back((uint8_t) SCo[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Emp); i++) + Vdat.push_back((uint8_t) Emp[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(SKe); i++) + Vdat.push_back((uint8_t) SKe[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Lim); i++) + Vdat.push_back((uint8_t) Lim[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(MDa); i++) + Vdat.push_back((uint8_t) MDa[i]); + + uint8_t tmp[128]; + copy(Vdat.begin(), Vdat.end(), tmp); + const uint8_t* data = tmp; + vfd.print(data, Vdat.size()); + Vdat.clear(); +} + +int PreMenu = 0; // 0=Main Menu; 1=Entrance; 2=Exit; 3=Set Config; 4=Set Key; 5=Mode Data +void Sub_Menu(int Menu) +{ + if(Menu != PreMenu) + { + vfd.GU7000_clearScreen(); + PreMenu = Menu; + } + + if(Menu == 0) + { + Main_Menu(); + } + + vector<uint8_t> dat; + + // Set Header + switch(Menu) { - uint8_t buffer[123]; - for(int j=0; j<123; j++) - { - buffer[j] = PGN[i][j]; - } - vfd.GU7000_setCursor(0, 8 * i); - vfd.GU7000_drawImage(123, 8, buffer); + case 0: break; + case 1: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MEn); i++) + dat.push_back((uint8_t) MEn[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 2: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MEx); i++) + dat.push_back((uint8_t) MEx[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 3: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MKo); i++) + dat.push_back((uint8_t) MKo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 4: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Set); i++) + dat.push_back((uint8_t) Set[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 5: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Mod); i++) + dat.push_back((uint8_t) Mod[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + dat.push_back('\n'); + break; + + case 6: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Mod); i++) + dat.push_back((uint8_t) Mod[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(His); i++) + dat.push_back((uint8_t) His[i]); + break; + } + + if(Menu != 0) + { + for(int i=0; i<strlen(Mas); i++) + dat.push_back((uint8_t) Mas[i]); } - wait(1); + + // Set Body + switch(Menu) + { + case 0: break; + case 1: + case 2: for(int i=0; i<strlen(PAS); i++) + dat.push_back((uint8_t) PAS[i]); + break; + + case 3: + case 4: for(int i=0; i<strlen(MTN); i++) + dat.push_back((uint8_t) MTN[i]); + break; + + case 5: for(int i=0; i<strlen(PUL); i++) + dat.push_back((uint8_t) PUL[i]); + break; + + case 6: for(int i=0; i<strlen(ENT); i++) + dat.push_back((uint8_t) ENT[i]); + break; + } + + // Set Footer + switch(Menu) + { + case 0: break; + case 6: + case 1: + case 2: + case 3: + case 4: dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Noo); i++) + dat.push_back((uint8_t) Noo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Bat); i++) + dat.push_back((uint8_t) Bat[i]); + break; + + case 5: dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Yes); i++) + dat.push_back((uint8_t) Yes[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Lan); i++) + dat.push_back((uint8_t) Lan[i]); + dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Noo); i++) + dat.push_back((uint8_t) Noo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Bat); i++) + dat.push_back((uint8_t) Bat[i]); + break; + } + + uint8_t tmp[128]; + copy(dat.begin(), dat.end(), tmp); + const uint8_t* data = tmp; + vfd.print(data, dat.size()); + dat.clear(); + + dbg.printf("Switch Menu is done\r\n"); } + +DigitalOut led(LED1); +Ticker run; +void runled() +{ + led =! led; +} + +int main() +{ + run.attach(&runled, 0.5); + Display_init(); + Main_Menu(); + set_time(1256729737); + while(1) + { + time_t t = time(NULL); + char buf[32]; + strftime(buf, 32, "%d/%m/%y %H:%M:%S", localtime(&t)); + vfd.printAt(1, 8, buf); + + vfd.GU7000_drawImageAt(122, 56, 6, 8, sym); + } + +}