一乐电子

一乐电子百科

 找回密码
 请使用微信账号登录和注册会员

QQ登录

只需一步,快速开始

快捷登录

手机号码,快捷登录

搜索
楼主: kazuyuki
收起左侧

[其他综合] ka板VFD安装

  [复制链接]
发表于 2012-4-8 17:21 | 显示全部楼层
记号一下
发表于 2012-4-8 21:25 | 显示全部楼层
支持,越看越对VFD兴趣越大了
我手上的也想点亮试一下
发表于 2012-4-9 11:35 | 显示全部楼层
记号再顶
发表于 2012-4-9 21:05 | 显示全部楼层
请问楼主数据转换部分的程序怎么理解啊,看不懂,也没有详细注释,请帮忙解释下吧
void VFD_Disp(void)
{
unsigned char base_a, temp=0, g_temp,i;
g_temp = 42 - (g >> 3);
i = (g & 7);
if (i == 0)
{
//*******************************TBlank start*******************************//
  G_BK_SET;
  _delay_us(3);
  G_LAT_SET;
  _delay_us(1);
  G_LAT_CLR;
  _delay_us(1);
  G_BK_CLR;
//*******************************TBlank stot********************************//
//   if (g >= 43)
  if (g >= 344)
  {
   g=0;
   G_CLK_CLR;
   G_SI_SET;
   G_CLK_SET;
   G_CLK_CLR;
   G_CLK_SET;
   G_SI_CLR;
   G_CLK_CLR;
   G_CLK_SET;
   G_CLK_CLR;
   G_CLK_SET;
   G_CLK_CLR;
   G_CLK_SET;
  }
  G_CLK_CLR;
  G_CLK_SET;
}
// base_a = (g_temp>>1) * 6;
base_a = g_temp * 3;
if (g_temp & 0x1)
{
  //双数列
//第一行
  /*     temp = ((buff[i][base_a+5] & 1)) << 1;
     temp |= ((buff[i][base_a+4] & 1)) << 3;
     temp |= ((buff[i][base_a+3] & 1)) << 5;
     temp |= ((buff[i][base_a+5] & 2)) << 6;
  */   temp = 0;
  if (buff[i][base_a+2] & 1) temp = 2;
  if (buff[i][base_a+1] & 1) temp |= 8;
  if (buff[i][base_a] & 1) temp |= 0x20;
//第一行
//第二行
  if (buff[i][base_a+2] & 2) temp |= 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp  = buff[i][base_a+1] & 2;
  if (buff[i][base_a] & 2) temp |= 8;
//第二行
//第三行
  if (buff[i][base_a+2] & 4) temp |= 0x20;
  if (buff[i][base_a+1] & 4) temp |= 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a] & 4) temp  |= 2;
//第三行
//第四行
  temp |= buff[i][base_a+2] & 8;
  if (buff[i][base_a+1] & 8) temp |= 0x20;
  if (buff[i][base_a] & 8) temp |= 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
//第四行
//第五行
  if (buff[i][base_a+2] & 0x10) temp = 2;
  if (buff[i][base_a+1] & 0x10) temp |= 8;
  if (buff[i][base_a] & 0x10) temp |= 0x20;
//第五行
//第六行
  if (buff[i][base_a+2] & 0x20) temp |= 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a+1] & 0x20) temp = 2;
  if (buff[i][base_a] & 0x20) temp |= 8;
//第六行
//第七行
  if (buff[i][base_a+2] & 0x40) temp |= 0x20;
  if (buff[i][base_a+1] & 0x40) temp |= 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a] & 0x40) temp = 2;
//第七行
//第八行
  if (buff[i][base_a+2] & 0x80) temp |= 8;
  if (buff[i][base_a+1] & 0x80) temp |= 0x20;
  temp |= buff[i][base_a] & 0x80;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
//第八行
//    }
} else {
  //单数列
//    for (i=0; i<8; i++)
//  {
//第一行
  temp  = buff[i][base_a] & 1;
  if (buff[i][base_a+1] & 1) temp |= 4;
  if (buff[i][base_a+2] & 1) temp |= 0x10;
//第一行
//第二行
  if (buff[i][base_a]   & 2) temp |= 0x40;
//     while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a+1] & 2) temp  = 1;
  if (buff[i][base_a+2] & 2) temp |= 4;
//第二行
//第三行
  if (buff[i][base_a]   & 4) temp |= 0x10;
  if (buff[i][base_a+1] & 4) temp |= 0x40;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a+2] & 4) temp  = 1;
//第三行
//第四行
  if (buff[i][base_a]   & 8) temp |= 4;
  if (buff[i][base_a+1] & 8) temp |= 0x10;
  if (buff[i][base_a+2] & 8) temp |= 0x40;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
//第四行
//第五行
  if (buff[i][base_a]   & 0x10) temp = 1;
  if (buff[i][base_a+1] & 0x10) temp |= 4;
  temp |= buff[i][base_a+2] & 0x10;
//第五行
//第六行
  if (buff[i][base_a]   & 0x20) temp |= 0x40;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a+1] & 0x20) temp = 1;
  if (buff[i][base_a+2] & 0x20) temp |= 4;
//第六行
//第七行
  if (buff[i][base_a]   & 0x40) temp |= 0x10;
  temp |= buff[i][base_a+1] & 0x40;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
  temp = 0;
  if (buff[i][base_a+2] & 0x40) temp = 1;
//第七行
//第八行
  if (buff[i][base_a]   & 0x80) temp |= 4;
  if (buff[i][base_a+1] & 0x80) temp |= 0x10;
  if (buff[i][base_a+2] & 0x80) temp |= 0x40;
  while(!(SPSR & BIT(SPIF)));
  SPDR = temp;
//第八行
//    }
}
g++;
}
 楼主| 发表于 2012-4-9 21:51 | 显示全部楼层
请问楼主数据转换部分的程序怎么理解啊,看不懂,也没有详细注释,请帮忙解释下吧
void VFD_Disp(void)
{ ...
zhengdahe 发表于 2012-4-9 21:05 https://www.yleee.com.cn/images/common/back.gif



    这个时序比较复杂,首先是生成G的时钟和数据位,然后根据G的位置,按a1,b1,c1,a2,b2,c2...a64,b64,c65的顺序(G是单数)或f1,e1,d1,f2,e2,d2,...,f64,e64,d64的顺序送出数据。其中abc中间插入0,变成a0b0c0顺序,def也一样,0f0e0d的顺序送出。
发表于 2012-4-9 22:50 | 显示全部楼层
数据取模的时候应该是列行式的吧?
 楼主| 发表于 2012-4-9 23:30 | 显示全部楼层
对,纵向8个点为一字节
发表于 2012-4-10 02:52 | 显示全部楼层
睡前一顶~~~~~~~~~~~~

【喜欢VFD真空荧光屏的坛友,可以加技术交流QQ群:198546227,交流经验。】
发表于 2012-4-10 17:04 | 显示全部楼层
太复杂了,还是等老大的模拟吧!
发表于 2012-4-10 23:33 | 显示全部楼层
时钟加上刻度更好

本版积分规则

QQ|一淘宝店|手机版|商店|电子DIY套件|一乐电子 ( 粤ICP备09076165号 ) 公安备案粤公网安备 44522102000183号

GMT+8, 2024-5-2 22:18 , Processed in 0.055117 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表