ja1yaz’s diary

感動したいおやじの備忘録的ブログ 

AQM1248Aを使いこなしたい。(8)

メモリの上限が見えてきてしまったので、汎用性をあきらめて、関数を分散させないで、作りこんでしまうことに方針転換して、とりあえず必要と思われる表示部分を作りこんでみることにした。

1か所のルーチンで、周波数、ステップ周波数、メーター表示、信号強度を入れ込んでしまうように変更してみた。

この方法だと、たくさんのメモリを使用せずに作りこめるので簡単になる。

AQM1248A 周波数、STEP、Sメータ、信号強度表示

これだと、場所さえあれば入れ込めるので簡単に変更ができる。

とりあえず必要な表示ができるようになったので表示部分の検討はこんなもんで行けそうだ。

コードは大幅に短縮して下記の様になった。

 

#RaspberryPi pico AQM1248A practice s-meter, step, signal, freq display 
from machine import SPI, Pin
import time
import random
import math
spi = SPI(0, baudrate=8000000, polarity=1, phase=1, bits=8, firstbit=SPI.MSB,sck=Pin(18),mosi=Pin(19))
cs=Pin(17,Pin.OUT)
rs=Pin(15,Pin.OUT)


#******************** ASCII char set***********************
f_dat=#    global lists
i=0
while i<0xff:
    f_dat.append([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
    i+=1

#Thanks for DR Open Font Project  imported from IZFL16.BDF
f_dat[0]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[1]=[0x08,0x08,0x1c,0x1c,0x3e,0x3e,0x7f,0x7f,0x3e,0x3e,0x1c,0x1c,0x08,0x08,0x00,0x00]
f_dat[2]=[0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x00,0x00]
f_dat[3]=[0x00,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x00,0x1f,0x04,0x04,0x04,0x04,0x04,0x00]
f_dat[4]=[0x00,0x7c,0x40,0x40,0x78,0x40,0x40,0x40,0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00]
f_dat[5]=[0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x1e,0x11,0x11,0x1e,0x12,0x12,0x11,0x00]
f_dat[6]=[0x00,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00]
f_dat[7]=[0x00,0x00,0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[8]=[0x00,0x00,0x08,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x08,0x00,0x7f,0x00,0x00,0x00]
f_dat[9]=[0x00,0x44,0x64,0x54,0x54,0x4c,0x44,0x44,0x00,0x08,0x08,0x08,0x08,0x08,0x0f,0x00]
f_dat[10]=[0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x1f,0x04,0x04,0x04,0x04,0x04,0x00]
f_dat[11]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[12]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[13]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[14]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[15]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[16]=[0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[17]=[0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[18]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[19]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00]
f_dat[20]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00]
f_dat[21]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0f,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[22]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xf8,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[23]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[24]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[25]=[0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08]
f_dat[26]=[0x00,0x00,0x00,0x06,0x18,0x60,0x18,0x06,0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00]
f_dat[27]=[0x00,0x00,0x00,0x60,0x18,0x06,0x18,0x60,0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00]
f_dat[28]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x24,0x24,0x24,0x24,0x24,0x46,0x00,0x00]
f_dat[29]=[0x00,0x00,0x00,0x00,0x02,0x02,0x04,0x7f,0x08,0x7f,0x10,0x10,0x20,0x00,0x00,0x00]
f_dat[30]=[0x00,0x00,0x00,0x00,0x10,0x28,0x20,0x20,0x10,0x7c,0x10,0x10,0x3c,0x52,0x20,0x00]
f_dat[31]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[32]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[33]=[0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00]
f_dat[34]=[0x00,0x00,0x12,0x12,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[35]=[0x00,0x00,0x24,0x24,0x7e,0x24,0x24,0x24,0x24,0x24,0x7e,0x24,0x24,0x24,0x00,0x00]
f_dat[36]=[0x14,0x1c,0x36,0x54,0x54,0x34,0x1c,0x14,0x16,0x15,0x55,0x55,0x36,0x1c,0x14,0x00]
f_dat[37]=[0x00,0x31,0x49,0x4a,0x32,0x04,0x04,0x08,0x08,0x10,0x16,0x29,0x29,0x46,0x00,0x00]
f_dat[38]=[0x00,0x00,0x18,0x24,0x24,0x24,0x28,0x10,0x2b,0x4a,0x44,0x46,0x25,0x19,0x00,0x00]
f_dat[39]=[0x00,0x00,0x08,0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[40]=[0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x08,0x00]
f_dat[41]=[0x00,0x10,0x08,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x00]
f_dat[42]=[0x00,0x00,0x00,0x00,0x00,0x42,0x24,0x18,0x7e,0x18,0x24,0x42,0x00,0x00,0x00,0x00]
f_dat[43]=[0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00]
f_dat[44]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x08,0x10]
f_dat[45]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[46]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00]
f_dat[47]=[0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x00,0x00]
f_dat[48]=[0x00,0x18,0x24,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x24,0x18,0x00,0x00]
f_dat[49]=[0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[50]=[0x00,0x18,0x24,0x42,0x42,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7e,0x00,0x00]
f_dat[51]=[0x00,0x18,0x24,0x42,0x42,0x02,0x04,0x1c,0x04,0x02,0x42,0x42,0x24,0x18,0x00,0x00]
f_dat[52]=[0x00,0x02,0x06,0x06,0x0a,0x0a,0x12,0x12,0x22,0x22,0x7f,0x02,0x02,0x02,0x00,0x00]
f_dat[53]=[0x00,0x3e,0x20,0x20,0x40,0x40,0x78,0x44,0x02,0x02,0x42,0x42,0x24,0x18,0x00,0x00]
f_dat[54]=[0x00,0x08,0x08,0x10,0x10,0x20,0x38,0x24,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00]
f_dat[55]=[0x00,0x7e,0x02,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x10,0x00,0x00]
f_dat[56]=[0x00,0x18,0x24,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x24,0x18,0x00,0x00]
f_dat[57]=[0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x24,0x1c,0x04,0x08,0x08,0x10,0x10,0x00,0x00]
f_dat[58]=[0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00]
f_dat[59]=[0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x08,0x10,0x00,0x00]
f_dat[60]=[0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00]
f_dat[61]=[0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[62]=[0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00]
f_dat[63]=[0x00,0x3c,0x42,0x42,0x42,0x42,0x02,0x04,0x08,0x08,0x00,0x00,0x08,0x08,0x00,0x00]
f_dat[64]=[0x00,0x1c,0x22,0x41,0x49,0x55,0x55,0x55,0x55,0x55,0x55,0x4a,0x20,0x1f,0x00,0x00]
f_dat[65]=[0x00,0x08,0x08,0x14,0x14,0x14,0x22,0x22,0x3e,0x22,0x41,0x41,0x41,0x41,0x00,0x00]
f_dat[66]=[0x00,0x78,0x44,0x42,0x42,0x44,0x78,0x44,0x42,0x42,0x42,0x42,0x44,0x78,0x00,0x00]
f_dat[67]=[0x00,0x1c,0x22,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x21,0x22,0x1c,0x00,0x00]
f_dat[68]=[0x00,0x78,0x44,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0x44,0x78,0x00,0x00]
f_dat[69]=[0x00,0x7e,0x40,0x40,0x40,0x40,0x40,0x7c,0x40,0x40,0x40,0x40,0x40,0x7e,0x00,0x00]
f_dat[70]=[0x00,0x7e,0x40,0x40,0x40,0x40,0x40,0x7c,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00]
f_dat[71]=[0x00,0x1c,0x22,0x20,0x40,0x40,0x40,0x40,0x47,0x41,0x41,0x21,0x22,0x1c,0x00,0x00]
f_dat[72]=[0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x42,0x00,0x00]
f_dat[73]=[0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[74]=[0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x42,0x24,0x18,0x00,0x00]
f_dat[75]=[0x00,0x41,0x42,0x44,0x48,0x50,0x78,0x48,0x44,0x44,0x42,0x42,0x41,0x41,0x00,0x00]
f_dat[76]=[0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3f,0x00,0x00]
f_dat[77]=[0x00,0x22,0x22,0x22,0x36,0x36,0x36,0x2a,0x2a,0x2a,0x22,0x22,0x22,0x22,0x00,0x00]
f_dat[78]=[0x00,0x42,0x62,0x62,0x62,0x52,0x52,0x52,0x4a,0x4a,0x4a,0x46,0x46,0x42,0x00,0x00]
f_dat[79]=[0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00]
f_dat[80]=[0x00,0x3c,0x22,0x21,0x21,0x21,0x22,0x3c,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00]
f_dat[81]=[0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x24,0x1a,0x00,0x00]
f_dat[82]=[0x00,0x3e,0x21,0x21,0x21,0x21,0x22,0x3c,0x24,0x24,0x22,0x22,0x21,0x21,0x00,0x00]
f_dat[83]=[0x00,0x18,0x24,0x42,0x40,0x20,0x18,0x04,0x02,0x01,0x41,0x41,0x22,0x1c,0x00,0x00]
f_dat[84]=[0x00,0x7f,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[85]=[0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00]
f_dat[86]=[0x00,0x41,0x41,0x41,0x22,0x22,0x22,0x14,0x14,0x14,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[87]=[0x00,0x51,0x51,0x51,0x51,0x2a,0x2a,0x2a,0x2a,0x2a,0x14,0x14,0x14,0x14,0x00,0x00]
f_dat[88]=[0x00,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x14,0x14,0x22,0x22,0x41,0x41,0x00,0x00]
f_dat[89]=[0x00,0x22,0x22,0x22,0x14,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[90]=[0x00,0x7f,0x01,0x02,0x02,0x04,0x08,0x08,0x10,0x20,0x20,0x40,0x40,0x7f,0x00,0x00]
f_dat[91]=[0x00,0x1c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1c,0x00,0x00]
f_dat[92]=[0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x00,0x00]
f_dat[93]=[0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00]
f_dat[94]=[0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[95]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00]
f_dat[96]=[0x00,0x00,0x30,0x30,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[97]=[0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x26,0x42,0x42,0x42,0x42,0x26,0x1a,0x00,0x00]
f_dat[98]=[0x00,0x00,0x40,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x64,0x58,0x00,0x00]
f_dat[99]=[0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x40,0x40,0x40,0x40,0x22,0x1c,0x00,0x00]
f_dat[100]=[0x00,0x00,0x02,0x02,0x02,0x02,0x1a,0x26,0x42,0x42,0x42,0x42,0x26,0x1a,0x00,0x00]
f_dat[101]=[0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x42,0x7e,0x40,0x40,0x22,0x1c,0x00,0x00]
f_dat[102]=[0x00,0x0c,0x10,0x10,0x10,0x10,0x3c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00]
f_dat[103]=[0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x26,0x42,0x42,0x42,0x42,0x26,0x1a,0x42,0x3c]
f_dat[104]=[0x00,0x00,0x40,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x42,0x42,0x00,0x00]
f_dat[105]=[0x00,0x00,0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[106]=[0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04]
f_dat[107]=[0x00,0x20,0x20,0x20,0x20,0x21,0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x21,0x00,0x00]
f_dat[108]=[0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[109]=[0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x69,0x49,0x49,0x49,0x49,0x49,0x49,0x00,0x00]
f_dat[110]=[0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x00,0x00]
f_dat[111]=[0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x41,0x41,0x41,0x41,0x22,0x1c,0x00,0x00]
f_dat[112]=[0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x64,0x42,0x42,0x42,0x42,0x64,0x58,0x40,0x40]
f_dat[113]=[0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x26,0x42,0x42,0x42,0x42,0x26,0x1a,0x02,0x02]
f_dat[114]=[0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x32,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00]
f_dat[115]=[0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x30,0x0c,0x02,0x42,0x3c,0x00,0x00]
f_dat[116]=[0x00,0x00,0x00,0x08,0x08,0x08,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00]
f_dat[117]=[0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00]
f_dat[118]=[0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00]
f_dat[119]=[0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x51,0x2a,0x2a,0x2a,0x14,0x14,0x14,0x00,0x00]
f_dat[120]=[0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x22,0x14,0x08,0x08,0x14,0x22,0x41,0x00,0x00]
f_dat[121]=[0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x22,0x22,0x14,0x14,0x14,0x08,0x08,0x08,0x30]
f_dat[122]=[0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x04,0x08,0x10,0x20,0x40,0x7e,0x00,0x00]
f_dat[123]=[0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x10,0x0c,0x00,0x00]
f_dat[124]=[0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00]
f_dat[125]=[0x00,0x30,0x08,0x08,0x08,0x08,0x08,0x04,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00]
f_dat[126]=[0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[127]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[128]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[129]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[130]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[131]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[132]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[133]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[134]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[135]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[136]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[137]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[138]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[139]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[140]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[141]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[142]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[143]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[144]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[145]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[146]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[147]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[148]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[149]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[150]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[151]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[152]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[153]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[154]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[155]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[156]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[157]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[158]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[159]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[160]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[161]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x30]
f_dat[162]=[0x3e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00]
f_dat[163]=[0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x3e]
f_dat[164]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x10]
f_dat[165]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[166]=[0x00,0x00,0x7e,0x02,0x02,0x02,0x7e,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x60,0x00]
f_dat[167]=[0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x04,0x14,0x08,0x08,0x08,0x10,0x10,0x20,0x00]
f_dat[168]=[0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x08,0x18,0x68,0x08,0x08,0x08,0x08,0x08,0x00]
f_dat[169]=[0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x41,0x41,0x01,0x02,0x02,0x04,0x18,0x00]
f_dat[170]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x7f,0x00]
f_dat[171]=[0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x7f,0x04,0x0c,0x14,0x24,0x44,0x04,0x0c,0x00]
f_dat[172]=[0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x7f,0x11,0x12,0x10,0x08,0x08,0x08,0x08,0x00]
f_dat[173]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x04,0x04,0x04,0x04,0x7f,0x00,0x00,0x00]
f_dat[174]=[0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x02,0x7e,0x02,0x02,0x7e,0x00,0x00,0x00]
f_dat[175]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x29,0x29,0x02,0x02,0x04,0x08,0x30,0x00]
f_dat[176]=[0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[177]=[0x00,0x00,0x7f,0x01,0x09,0x0a,0x0a,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x00]
f_dat[178]=[0x00,0x01,0x01,0x01,0x02,0x02,0x04,0x0c,0x14,0x64,0x04,0x04,0x04,0x04,0x04,0x00]
f_dat[179]=[0x00,0x08,0x08,0x08,0x7f,0x41,0x41,0x41,0x01,0x01,0x01,0x02,0x02,0x04,0x18,0x00]
f_dat[180]=[0x00,0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x7f,0x00,0x00]
f_dat[181]=[0x00,0x04,0x04,0x7f,0x04,0x0c,0x0c,0x14,0x14,0x14,0x24,0x24,0x44,0x04,0x0c,0x00]
f_dat[182]=[0x00,0x08,0x08,0x08,0x7f,0x09,0x09,0x09,0x09,0x11,0x11,0x12,0x22,0x22,0x44,0x00]
f_dat[183]=[0x00,0x10,0x10,0x10,0x1e,0x70,0x08,0x08,0x0f,0x78,0x08,0x08,0x04,0x04,0x04,0x00]
f_dat[184]=[0x00,0x08,0x08,0x0f,0x11,0x11,0x21,0x41,0x02,0x02,0x04,0x04,0x08,0x10,0x60,0x00]
f_dat[185]=[0x00,0x20,0x20,0x20,0x3f,0x24,0x24,0x44,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x00]
f_dat[186]=[0x00,0x00,0x00,0x7e,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x7e,0x00,0x00]
f_dat[187]=[0x00,0x12,0x12,0x12,0x7f,0x12,0x12,0x12,0x12,0x04,0x04,0x04,0x08,0x08,0x10,0x00]
f_dat[188]=[0x00,0x00,0x38,0x00,0x00,0x00,0x71,0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x60,0x00]
f_dat[189]=[0x00,0x00,0x00,0x7e,0x02,0x04,0x04,0x04,0x08,0x08,0x14,0x12,0x22,0x21,0x41,0x00]
f_dat[190]=[0x00,0x10,0x10,0x10,0x10,0x17,0x79,0x11,0x12,0x12,0x10,0x10,0x10,0x08,0x07,0x00]
f_dat[191]=[0x00,0x01,0x41,0x41,0x21,0x01,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x00]
f_dat[192]=[0x00,0x08,0x08,0x0f,0x11,0x11,0x29,0x45,0x02,0x02,0x04,0x04,0x08,0x10,0x60,0x00]
f_dat[193]=[0x00,0x02,0x0c,0x38,0x48,0x08,0x08,0x7f,0x08,0x08,0x08,0x08,0x10,0x10,0x60,0x00]
f_dat[194]=[0x00,0x00,0x52,0x52,0x52,0x42,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x00]
f_dat[195]=[0x00,0x00,0x3e,0x00,0x00,0x00,0x7f,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00]
f_dat[196]=[0x00,0x20,0x20,0x20,0x20,0x20,0x38,0x24,0x22,0x20,0x20,0x20,0x20,0x20,0x20,0x00]
f_dat[197]=[0x00,0x08,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00]
f_dat[198]=[0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00]
f_dat[199]=[0x00,0x00,0x7f,0x01,0x01,0x01,0x22,0x1a,0x04,0x06,0x0a,0x09,0x11,0x21,0x40,0x00]
f_dat[200]=[0x00,0x08,0x08,0x08,0x7f,0x02,0x04,0x04,0x0a,0x19,0x29,0x48,0x08,0x08,0x08,0x00]
f_dat[201]=[0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x00]
f_dat[202]=[0x00,0x00,0x12,0x12,0x12,0x12,0x12,0x11,0x11,0x21,0x21,0x21,0x21,0x41,0x40,0x00]
f_dat[203]=[0x00,0x40,0x40,0x40,0x40,0x40,0x46,0x78,0x40,0x40,0x40,0x40,0x40,0x20,0x1e,0x00]
f_dat[204]=[0x00,0x00,0x7f,0x01,0x01,0x01,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x00]
f_dat[205]=[0x00,0x00,0x10,0x28,0x28,0x44,0x44,0x04,0x02,0x02,0x02,0x01,0x01,0x01,0x00,0x00]
f_dat[206]=[0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x2a,0x2a,0x2a,0x49,0x49,0x49,0x08,0x08,0x00]
f_dat[207]=[0x00,0x00,0x7e,0x02,0x02,0x02,0x04,0x24,0x24,0x18,0x18,0x10,0x08,0x08,0x08,0x00]
f_dat[208]=[0x00,0x00,0x38,0x06,0x01,0x00,0x30,0x0c,0x02,0x00,0x70,0x0c,0x02,0x01,0x00,0x00]
f_dat[209]=[0x00,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x10,0x12,0x22,0x21,0x27,0x39,0x41,0x00]
f_dat[210]=[0x00,0x01,0x01,0x01,0x02,0x32,0x0a,0x04,0x06,0x0a,0x09,0x11,0x11,0x20,0x40,0x00]
f_dat[211]=[0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x08,0x08,0x08,0x07,0x00]
f_dat[212]=[0x00,0x20,0x20,0x20,0x27,0x79,0x21,0x12,0x12,0x10,0x10,0x08,0x08,0x08,0x08,0x00]
f_dat[213]=[0x00,0x00,0x00,0x00,0x3c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x7f,0x00,0x00]
f_dat[214]=[0x00,0x00,0x00,0x7e,0x02,0x02,0x02,0x02,0x7e,0x02,0x02,0x02,0x02,0x02,0x7e,0x00]
f_dat[215]=[0x00,0x00,0x3c,0x00,0x00,0x00,0x7e,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x00]
f_dat[216]=[0x00,0x02,0x22,0x22,0x22,0x22,0x22,0x22,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x00]
f_dat[217]=[0x00,0x00,0x08,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x4c,0x4c,0x48,0x00]
f_dat[218]=[0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x44,0x44,0x48,0x50,0x60,0x00]
f_dat[219]=[0x00,0x00,0x00,0x7e,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x7e,0x42,0x00,0x00]
f_dat[220]=[0x00,0x00,0x7e,0x42,0x42,0x42,0x42,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x00]
f_dat[221]=[0x00,0x00,0x60,0x10,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x60,0x00]
f_dat[222]=[0x00,0x00,0x10,0x48,0x24,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[223]=[0x00,0x00,0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[224]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[225]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[226]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[227]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[228]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[229]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[230]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[231]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[232]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[233]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[234]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[235]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[236]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[237]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[238]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[239]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[240]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[241]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[242]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[243]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[244]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[245]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[246]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[247]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[248]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[249]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[250]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[251]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[252]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[253]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
f_dat[254]=[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]


#******************** Meter data set***********************
M_data=#   global lists
meter_xsize=69
meter_ysize=12
i=0
while i<meter_ysize+1:
    M_data.append([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
    i+=1
    
#print(M_data,x,y,signal_st)
#***************  Bar graph data 11step (original)  ******************
M_data[11]=[0x000000000000000008,0x000000000000000018,0x0000000000000001B8,0x000000000000001BB8,0x000000000000007BB8,0x000000000000037BB8,0x000000000000EF7BB8,0x00000000003BEF7BB8,0x000000001DFBEF7BB8,0x0000077EFDFBEF7BB8,0x077F7F7EFDFBEF7BB8,0xFF7F7F7EFDFBEF7BB8]
M_data[10]=[0x000000000000000000,0x000000000000000000,0x000000000000000100,0x000000000000001B00,0x000000000000007B00,0x000000000000037B00,0x000000000000EF7B00,0x00000000003BEF7B00,0x000000001DFBEF7B00,0x0000077EFDFBEF7B00,0x077F7F7EFDFBEF7B00,0xFF7F7F7EFDFBEF7B00]    
M_data[9]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000001800,0x000000000000007800,0x000000000000037800,0x000000000000EF7800,0x00000000003BEF7800,0x000000001DFBEF7800,0x0000077EFDFBEF7800,0x077F7F7EFDFBEF7800,0xFF7F7F7EFDFBEF7800]
M_data[8]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000030000,0x000000000000EF0000,0x00000000003BEF0000,0x000000001D3BEF0000,0x0000077EFD3BEF0000,0x077F7F7EFD3BEF0000,0xFF7F7F7EFD3BEF0000]    
M_data[7]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000E00000,0x00000000003BE00000,0x000000001DFBE00000,0x0000077EFDFBE00000,0x077F7F7EFDFBE00000,0xFF7F7F7EFDFBE00000]
M_data[6]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000038000000,0x000000001DF8000000,0x0000077EFDF8000000,0x077F7F7EFDF8000000,0xFF7F7F7EFDF8000000]    
M_data[5]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000001C00000000,0x0000077EFC00000000,0x077F7F7EFC00000000,0xFF7F7F7EFC00000000]
M_data[4]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x0000077E0000000000,0x077F7F7E0000000000,0xFF7F7F7E0000000000]    
M_data[3]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000007000000000000,0x077F7F000000000000,0xFF7F7F000000000000]
M_data[2]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x077F00000000000000,0xFF7F00000000000000]    
M_data[1]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x070000000000000000,0xFF0000000000000000]
M_data[0]=[0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000,0x000000000000000000]    


def lcd_cmd_write(cmd):
    cs.value(0)
    rs.value(0)
    spi.write(cmd.to_bytes(1,"big"))
    cs.value(1)
    
def lcd_data_write(data):
    cs.value(0)
    rs.value(1)
    spi.write(data.to_bytes(1,"big"))
    rs.value(0)
    cs.value(1)
    
def lcd_reset():
    
    i=0
    j=0
    data=0xe1#colum address increment when write 
    lcd_cmd_write(data)
    while i<8:
        data=0xb0+i#Page address set  0xb0+Page
        lcd_cmd_write(data)
        #print(i,data.to_bytes(1,"big"))
        data=0x10#colum address set upperbit
        lcd_cmd_write(data)
        data=0x00#colum address set lowerbit 
        lcd_cmd_write(data)
        j=0
        while j<128:
            data=0x00
            lcd_data_write(data)
            j+=1
        i+=1
  
def init_lcd():
    #data=0xe2#Reset
    #lcd_cmd_write(data)
    #time.sleep_ms(2)
    data=0xae#Display OFF  ON:0xaf   OFF:0xae
    lcd_cmd_write(data)
    data=0xa0#ADC=normal   normal:0xa0    reverse:0xa1
    lcd_cmd_write(data)
    data=0xc8#Command output=reverse  nornal:0xc8    reverse:0xc0
    lcd_cmd_write(data)
    data=0xa3#bias=1/7  1/9:0xc2   1/7(ST7565R):0xc3
    lcd_cmd_write(data)
    
    #regurator settings
    data=0x2c#power control 1
    lcd_cmd_write(data)
    time.sleep_ms(2)
    data=0x2e#power control 2
    lcd_cmd_write(data)
    time.sleep_ms(2)
    data=0x2f#power control 3
    lcd_cmd_write(data)
    time.sleep_ms(2)
    #data=0x2c#power control 1
    #lcd_cmd_write(data)
    #time.sleep_ms(2)
    
    #Contrast setting
    data=0x23#Vo voltage resistor ratio set
    lcd_cmd_write(data)
    data=0x81#Electronic volume mode set
    lcd_cmd_write(data)
    data=0x1c#Electronic volume value set
    lcd_cmd_write(data)
    
    #Display setting
    data=0xa4#display all point=normal
    lcd_cmd_write(data)
    data=0x40#display start line=0
    lcd_cmd_write(data)
    data=0xa6#Display normal/reverse=normal 
    lcd_cmd_write(data)
    lcd_reset()
    data=0xaf#Dosplay =ON
    lcd_cmd_write(data)
    #lcd_reset()
def colum_set(colum):
    colum_upper=int(colum/0x100)
    colum_lower=colum % 0x100

    data=0x10+colum_upper#colum address set upperbit
    lcd_cmd_write(data)
    data=0x00+colum_lower#colum address set lowerbit 
    lcd_cmd_write(data)

def incr_set():
    data=0xe1#colum address increment when write 
    lcd_cmd_write(data)
    
def dim_change(x,y):
    dot_location=x+128*y
    
    return dot_location


def f_display(f_char0,step0,signal_st0):

    #******************** frequency display setting *************************
    i=0
    j=0
    k=0
    #**********freq position***********
    x0=10
    y0=2
    imagef_lists=[0]*128*64
    font_size_t=16
    font_size_w=8
    while i<font_size_t:
        a=0
        j=0
        while j<font_size_w*len(f_char0):
        
            fchar_ord=ord(f_char0[int(j/font_size_w)])
        
            a=f_dat[fchar_ord][i]
            a=(a<<j%font_size_w)%0x100
            a=a>>(font_size_w-1)
            imagef_lists[x0+j+(i+y0)*128]=a
            a=0   
            j+=1
        i+=1
    
    #*************** signal_strength ******************
    i=0
    j=0
    k=0
    f_char1='S '+str(signal_st0)
    if signal_st0==8:
        f_char1='S 9'
    elif signal_st0==9:
        f_char1='S 9+'
    elif signal_st0==10:
        f_char1='S +20'
    elif signal_st0==11:
        f_char1='S +40'
    elif signal_st0==0:
        f_char1='  low'
    #**********sgnal strength position***********
    x1=83
    y1=33
    while i<font_size_t:
        a=0
        while j<font_size_w*len(f_char1):
        
            fchar_ord=ord(f_char1[int(j/font_size_w)])
        
            a=f_dat[fchar_ord][i]
            a=(a<<j%font_size_w)%0x100
            a=a>>(font_size_w-1)
            imagef_lists[x1+j+(i+y1)*128]=a
            a=0   
            j+=1

        j=0
        i+=1
    #*************step******************
    i=0
    j=0
    k=0
    f_char2='step:'+str(step0)
    #**********step freq position***********
    x2=55
    y2=18

    while i<font_size_t:
        a=0
        while j<font_size_w*len(f_char2):
        
            fchar_ord=ord(f_char2[int(j/font_size_w)])
            a=f_dat[fchar_ord][i]
            a=(a<<j%font_size_w)%0x100
            a=a>>(font_size_w-1)
            imagef_lists[x2+j+(i+y2)*128]=a
            a=0   
            j+=1

        j=0
        i+=1

    #*************** meter display set*********************

    i=0
    j=0
    meter_x0=10
    meter_y0=35
    b=M_data[signal_st0]
    while i<meter_ysize:
        j=0
        while j<meter_xsize:
            a=b[i]
            a=a>>(3+j)
            a=a%2
            imagef_lists[meter_x0+meter_xsize-j+128*(meter_y0+i)]=a
            j+=1
        i+=1
   
    return imagef_lists

def graph_disp(image_lists):
    i=0
    while i<8:
        cmd=0xb0+i
        lcd_cmd_write(cmd)
        colum_set(0)
    
        j=0
        while j<128:
            a=0
            b=0
            k=0
            while k<8:
                a=image_lists[j+(i*8+k)*128]
                b=b+a*2**k
                k+=1
            lcd_data_write(b)
            j+=1
        i+=1 

 


init_lcd()
lcd_reset()

#**************char display setting ****************
fchar='123456789.0Hz'
step=100
#************** S meter display setting ************
signal_st=11

graph_disp(f_display(fchar,step,signal_st))
time.sleep(10)
#*******changing s meter display *********
i_gl=0
#y=20
while i_gl<1000:
    signal_st=int(12*random.random())
    time.sleep(0.1)
    #print(i_gl)
    graph_disp(f_display(fchar,step,signal_st))
    
    i_gl+=1