HL-D793G七位蓝色+PT6311驱动

Posted katachi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HL-D793G七位蓝色+PT6311驱动相关的知识,希望对你有一定的参考价值。

和之前那块一起买的。又画了这个屏幕驱动,还画了灯丝电源驱动,和以前画的stm8核心板在JLC拼板。

亚光黑颜色,不单独收钱!

技术图片

 

技术图片

切好水洗吹干!

技术图片

忘记给排针加丝印,手写代之。

焊接的时候,脑子发热,以为把层搞错了,结果就掰PT6311引脚,然后反向焊接。焊接好通电电流一下子上1A,检查半天发现没反!

技术图片

调PT6311程序时顺便发现上次pcb画错了grid和segment,233.当时死活想不通芯片为什么这样设计,原来是自己搞反了。

技术图片
  1 #include "pt6311.h"
  2 #include "stdio.h"
  3 #include <string.h>
  4 #include <intrins.h>
  5 //auth:katachi
  6 //time:2017-12-30
  7 //func:driver for pt6311
  8 //transplant to stm8 time:2018-1-14 17:
  9 //modify for 51 :2019年4月21日22:30:57
 10 //auto addr sequence:
 11 /*
 12     OpenStrobe_PT6311();
 13     WriteByte_PT6311(CMD_ModeSetting|0x00);//8grid 20seg
 14     
 15     OpenStrobe_PT6311();
 16     WriteByte_PT6311(CMD_DataSetting|0x00);    ////autoAdd addr
 17     
 18     OpenStrobe_PT6311();
 19     WriteByte_PT6311(CMD_AddressSetting|0x00);    //start addr 0x00
 20     WriteByte_PT6311(0x7e);                                            //seg0-seg7
 21     WriteByte_PT6311(0x18);                                            //seg8-seg15
 22     WriteByte_PT6311(0x2);                                            //seg16-seg23        
 23     
 24     OpenStrobe_PT6311();
 25     WriteByte_PT6311(CMD_DisplaySetting|0x0f);//on 14/16
 26     STB=1;    
 27 */
 28 //
 29 sbit DI     =P3^5;
 30 sbit DO    =P1^2;
 31 sbit CK    =P3^4;            
 32 sbit STB =P3^3;    
 33 void Delay1us()        //@12.000MHz
 34 {
 35     _nop_();
 36     _nop_();
 37     _nop_();
 38     _nop_();
 39 }
 40 void Delay1ms()        //@12.000MHz
 41 {
 42     unsigned char i, j;
 43 
 44     i = 12;
 45     j = 169;
 46     do
 47     {
 48         while (--j);
 49     } while (--i);
 50 }
 51 void  delay_us(u8  n){
 52     while(n--)Delay1us();
 53 }
 54 void  delay_ms(u32 n){
 55     while(n--)Delay1ms();
 56 }
 57 const u8  ADDR[]={                                      
 58                             0x00,0x01,//digit 1
 59                             0x03,0x04,//digit 2
 60                             0x06,0x07,//digit 3
 61                             0x09,0x0a,//digit 4
 62                             0x0c,0x0d,//digit 5
 63                             0x0f,0x10,//digit 6
 64                             0x12,0x13,//digit 7
 65                             0x15,0x16,//digit 8
 66                             0x18,0x19,//digit 9
 67                             0x1B,0x1C,//digit 10
 68                             0x1E,0x1F,//digit 11
 69                             0x21,0x22,//digit 12
 70                             0x24,0x25,//digit 13
 71                             0x27,0x28,//digit 14
 72                             0x2a,0x2b};//digit 15
 73 const u16 font[44]={
 74 0x187e,0xc,0x1b6,0x19e,0x1cc,0x1da,0x1fa,0x1802,0x1fe,0x1de,//0-9
 75 0x1ee,0x251e,0x72,0x241e,0x1f2,0x1e2,0x17a,0x1ec,0x2412,0x1c,0x48e0,0x70,0x2a6c,0x426c,0x7e,0x1e6,
 76 0x407e,0x41e6,0x31a,0x2402,0x7c,0x1860,0x546c,0x5a00,0x2a00,0x1812,//a-z
 77 0x2580,0x180,0x7f80,0x1800,0x2400,0x4200,0x10,0x8000,};//+-*/|\\_.
 78 /*
 79 //ascii code :
 80 0:48 
 81 A:65
 82 for number:
 83 dspseg[i]=dspseg[i]-48;
 84 for alphabet:
 85 dspseg[i]=dspseg[i]-65+10;
 86 */
 87 u8 dspbuf[24];    //bytes to send
 88 u8 dspseg[8];    //character to dis
 89 unsigned int Pow2(u8 y)
 90 {
 91     u16 x=1;
 92     if (y)
 93     {
 94         while (y--)
 95             x*=2;
 96     }
 97     else
 98         x=1;
 99     return x;
100 }
101 void OpenStrobe_PT6311(void)
102 {
103     STB=1;
104     delay_us(1);
105     STB=0;
106 }
107 void Init_PT6311(void)
108 {
109     u8 i;
110     
111     OpenStrobe_PT6311();
112     WriteByte_PT6311(CMD_ModeSetting|0x00);//8grid 20seg
113 
114     OpenStrobe_PT6311();
115     WriteByte_PT6311(CMD_DataSetting|0x00);    ////autoAdd addr
116     
117     OpenStrobe_PT6311();
118     WriteByte_PT6311(CMD_DisplaySetting|0x8|4);//0x80:on 14/16
119     
120     //all on
121     OpenStrobe_PT6311();
122     WriteByte_PT6311(CMD_AddressSetting|0x00);    
123     for (i=0;i<24;i++){
124         WriteByte_PT6311(0xff);
125     }
126     delay_ms(1000);
127     //all clr
128     OpenStrobe_PT6311();
129     WriteByte_PT6311(CMD_AddressSetting|0x00);    
130     for (i=0;i<24;i++){
131         WriteByte_PT6311(0);
132     }    
133     delay_ms(1000);
134     //show number
135     strcpy(dspseg,"12345678");
136     for (i=0;i<8;i++)dspseg[i]=dspseg[i]-48;    
137     OpenStrobe_PT6311();
138     WriteByte_PT6311(CMD_AddressSetting|0x00);
139 
140     for (i=7;i!=0xff;i--){
141         WriteByte_PT6311(font[dspseg[i]]);//low byte
142         WriteByte_PT6311(font[dspseg[i]]>>8);//high byte
143         WriteByte_PT6311((font[dspseg[i]]&0x8)?0x2:0x0);//replace grid4 with grid18:low byte ----,grid4--- grid4&0x8 to get the segment
144     }    
145     delay_ms(1000);
146     //show aplhabet
147     strcpy(dspseg," HELLOOO");
148     for (i=0;i<8;i++)dspseg[i]=dspseg[i]-55;
149     OpenStrobe_PT6311();
150     WriteByte_PT6311(CMD_AddressSetting|0x00);
151     for (i=7;i!=0xff;i--){//0xff:for overflow
152         WriteByte_PT6311(font[dspseg[i]]);//low byte
153         WriteByte_PT6311(font[dspseg[i]]>>8);//high byte
154         WriteByte_PT6311((font[dspseg[i]]&0x8)?0x2:0x0);//replace grid4 with grid18:low byte ----,grid4--- grid4&0x8 to get the segment
155     }        
156 }
157 void WriteByte_PT6311(u8 dat)
158 {
159     u8 i;
160 
161     CK=1;//de-pulldown
162     for (i=0;i<8;i++)
163     {
164         CK=0;    //>>200ns
165         DI=dat&0x01;        //send a bit to pt6311‘s data in pin
166         dat>>=1;                //lsb first
167         CK=1;
168     }
169 }
170 u8 ReadByte_PT6311(void)
171 {
172     u8 dat,i;
173     CK=1;
174     delay_us(2);
175     for (i=0;i<8;i++)
176     {
177         CK=0;//while (j++<10);
178         delay_us(1);//tplz tpzl
179         dat>>=1;                //lsb first
180         if (DO)
181             dat|=0x80;                //catch a bit from pt6311‘s data out pin
182         CK=1;
183     }
184     delay_us(1);//tclk stb
185     return dat;
186 }
View Code

这个芯片亮品率低,总是有的脚不能输出,这里的grid4通到引脚了但是还是没输出。

飞线到grid18,程序里加判断然后追加赋值解决。

取模绝对不会像上次那样自己算,本来想qt写个小软件。网上一找发现不少米字屏取模软件,PT6311选共阴。然后这个屏0-8的1是a段,再写段小程序左移一位得到字库。

技术图片

 

以上是关于HL-D793G七位蓝色+PT6311驱动的主要内容,如果未能解决你的问题,请参考以下文章

css PT Sans Google字体片段

天翼网关型号PT926E接入移动光纤怎样设置?

端面试每日 3+1 —— 第793天

如何在Android的谷歌地图片段中更改默认的蓝色圆形位置图标?

pt952g光纤猫参数

pt921g自动拨号设置 介绍pt921g自动拨号设置