PT6311 ile seri haberleşmek

Başlatan Sdttn, 30 Haziran 2011, 19:20:42

Sdttn

Merhabalar,
Picler ile yeni uğraşmaya başladım kullandığım dil BASIC.

PT6311 Vakum floresan display sürücü entegresiyle haberleşmek istiyorum. Ancak haberleşme metodunu eksik teknik ingilizce bilgimden dolayı anlayamadım. Kullancağım pic 16F628.

PT6311'in datasheet.
http://read.pudn.com/downloads136/sourcecode/embed/582032/PT6311.pdf

Teşekkürler.

Sdttn

Bu ram adreslerini anlatacak biri var mı?


-Hasan-

Arkadaşım, datasheet ' ine biraz göz attım ancak çok çok iyi ingilizcem olmadığı için ve adını ilk defa duyduğum bir entegre olduğundan ancak haberleşme kısmında bir şeyler söyleyebileceğim; Haberleşme diyagramını incelediğimizde, iletişim SPI ' dan biraz farklı, bu fark ise verinin yollanmaya LSB ' den başlanması, bu hariç diğer her şeyi SPI ile aynı. Bu haberleşmede MSSP modülü kullanılabilir ancak araya özel bir yazılım konularak verilerin simetrik olarak değiştirilmesi gerekir, eğer veriyi direk yollarsak entegre gönderdiğimiz verinin; 7. bitini 0. bit olarak, 6. biti 1. bit olarak ........ 0. bitini 7. bit olarak algılar, bunun sebebi SPI ' ın MSB ' yi önce göndermesi, entegrenin LSB ' yi önce almasındandır. Yapılacak bir yazılımla veriler önceden bu şekilde değiştirilerek bu sorun önlenir. Ancak bu programı ASM ile yapacağız, eğer PBP ' de assembly çalıştırabilirsen kodları yazarız.

Sdttn

Lookup tablolarını tersten yaparız o zaman. İlgilendiğiniz için teşekkürler.
Bu datasheet daha okunabilir.
http://pdf1.alldatasheet.com/datasheet-pdf/view/391600/PTC/PT6311.html

-Hasan-

#4
Önemli bir nokta daha; bu entegrenin iletişimi 74HC595 ' den farklıdır. Bu entegreyle iletişim yaparken MSSP ayarlarını:

SSPCON=$32
SSPSTAT=$00


şeklinde yapmanız gerekir.

Kolay Gelsin.

Sdttn

#5
Bu ram tablolarını anlamadım digit'lerde nasıl karakter oluşturulacak?
Öyle sanıyorum ki Ram tablosunu anlarsam nasıl karakter oluşturulacağını anlamış olurum.

Tablo üzerindeki L ve U harfleri ne demek oluyor hex bir sayı olmadıkları çok açık?

(Datasheet'den alıntı, Sayfa 8)


C de yazılmış kaynak kod buldum ama kodun açıklamalarının çoğu çince (olmayabilir de)
Kodu ekliyorum.

    /* ·¢ËÍÊı¾İµ½PT6311½øĞĞÏÔʾ */   
    /* ²ÎÊı0: PAR[0] ҪдµÄÏÔ´æµØÖ·(MSB: 1 1 B5,B4,B3,B2,B1,B0 :LSB)(B5-B0 MEM START ADDRESS) */   
    /* ²ÎÊı1: PAR[1] Ğ´µÄµÍ8λÊı¾İ(ÏÈËͳö, ÇÒ´Óbit0λ¿ªÊ¼) */   
    /* ²ÎÊı2: PAR[2] Ğ´µÄÖĞ8λÊı¾İ */   
    /* ²ÎÊı3: PAR[3] Ğ´µÄ¸ß1λÊı¾İ */   
    /* ²ÎÊı PAR_T;    λ±äÁ¿,¿É×÷Ϊº¯²ÎÊı */   
    /* VFDµÄʹÓã¬ÏÈÓà */   
       
    /* 48    pt6311¼ü×ÜÊı(48¸ö) */   
    /* 0x0C  ÏÔʾģʽÉèÖÃÃüÁî(0000,1100=0CH 13G,15P */   
    /* 0x40  Êı¾İÉèÖÃÃüÁî,Ğ´Êı¾İµ½ÏÔʾ¼Ä´æÆ÷,Êı¾İĞ´ÈëºóµØÖ·Ôö¼Ó,Ò»°ã¹¤×÷ģʽ */   
    /* 0x41  Ğ´Êı¾İµ½LEDÃüÁî*/   
    /* 0x42  PT6311¶Á¼üÖµÃüÁî·û */   
    /* 0x8f  ÏÔʾ¿ØÖÆÃüÁî,Sets pulse width to 14/16. Display on */   
    /* 0xC0  µØÖ·ÉèÖÃÃüÁî pt6311µÄDisplay RAMµÄÆğʼµØÖ·00-2f */   
    /* 0x43  ¶ÁSWµÄÖµ */   
       
    void wvfd_6311()   
    {   
       bc_stb_6311=0;  // pt6311 stb=0 (ENABLE)   
       some_nop();   
       par_t=0x40;    /* Êı¾İÉèÖÃÃüÁдÊı¾İµ½ÏÔʾ¼Ä´æÆ÷£¬£¬Êı¾İĞ´ÈëºóµØÖ·Ôö¼Ó£¬Ò»°ã¹¤×÷ģʽ */   
       disp_6311();   
       bc_stb_6311=1;  /* pt6311 stb=0 (ENABLE) ÏȹصôSTAB£¬È»ºóÔÙ´ò¿ª£¬Õâ»á»áÎȶ¨Ğ©  */   
       some_nop();   
       bc_stb_6311=0;  // pt6311 stb=0 (ENABLE)      
       some_nop();   
       par_t=par[0];   
       disp_6311();   
       some_nop();   
       par_t=par[1];   
       disp_6311();   
       some_nop();   
       par_t=par[2];   
       disp_6311();   
       bc_stb_6311=1;      // PT6311 DISABLE   
    }   
       
    /* ¶Á¼üÅÌ°´¼ü×Ó³ÌĞò  */   
    /* ·µ»Ø: key_6311  ·µ»Ø¼üÖµ, 0=ÎŞ°´¼ü  ,²»¿ÉÓÃPAR[0] ×÷Ϊ²ÎÊı£¬·ñÔòÏÔʾÂÒ */   
    void getkey_6311()   
    {   
      uchar i;   
      bc_stb_6311=1;   
      _nop_(); _nop_(); _nop_(); _nop_();   
      bc_stb_6311=0;   
      some_nop();   
      par_t=0x72;  /* Ïòpt6311·¢ËͶÁ¼üÖµÃüÁî */   
      disp_6311();   
      some_nop();   
      key_6311=0;          
     // par[0]=0;      /* ²»ÄÜÓÃPAR[0] ×÷Ϊ²ÎÊı£¬·ñÔòÏÔʾÂÒ */   
     // bc_data_6311=0;    
      for(i=48;i>0;i--)  /* 6311 ×Ü48 ¸ö¼ü */   
        {   
          bc_clk_6311=1;    
          bc_data_6311=1;   
          some_nop();   
          bc_clk_6311=0;    
          some_nop();   
          if(bc_data_6311==1)      
            { key_6311=i;       /* ԭΪ par[0]=i; ʱÏÔʾÂÒ */   
              break;   
            }   
        }   
     bc_stb_6311=1;   
     some_nop();   
    }   
       
       
    /* ÏÔʾģʽÃüÁî ·ÖG£¬P */   
    void setup_6311()   
    {   
      bc_stb_6311=0;      // ready to send data to pt6311 STB   
      some_nop();   
      par_t=0x0c;        // 0000,1100=0CH 13G,15P   
      disp_6311();       //  send command to pt6311,here is set displayer mod,11dig/17seg   
      some_nop();   
      bc_stb_6311=1;     
    }   
       
    /* ------- ´ò¿ªÓ«¹âÏÔʾ ÏÔʾ¿ØÖÆÃüÁî --------  */   
    void dim_vfd()   
    {    
      bc_stb_6311=0;             /* STD=0  µãÁÁÏÔʾ×Ö·û */   
      some_nop();   
      par_t=0x8f;  /* ÏÔʾ¿ØÖÆÃüÁî,Sets pulse width to 14/16. Display on */   
      disp_6311();   
      bc_stb_6311=1;           //STD=1   
    }    
       
    /* ÇåÆÁ */   
    void clear_vfd()   
    {   
      uchar i;   
      bc_stb_6311=0;   
      par[0]=0xc0;   
      par[1]=0x00;   
      par[2]=0x00;   
      for(i=0;i<14;i++)   
        {   
          wvfd_6311();       /* ËÍÈëpt6311ÏÔ´æ */   
          par[0]=0xc0+3*i;   /*  start address move to next digit ÏÂÒ»¶Î,¶ÎµØÖ·  */   
        }   
      bc_stb_6311=1;   
    }   
       
       
       
    /* ËÍÊı¾İµ½6311µÄLED¿Ú  */   
    /* ²ÎÊıPAR[0]   PAR[0]--LEDÊı¾İ */   
    void wled_6311()   
    {   
      bc_stb_6311=0;   /* PT6311 ENBLE  */   
      par_t=0x41;      // data set command--write data to LED PORT   
      disp_6311();     // sendn data to pt6311 here is data set command   
      par_t=led_6311;    // pt6311 LED DATA to PAR[0]   
      disp_6311();     // send data to pt6311 here is address set command   
      bc_stb_6311=1;   // pt6311 disable   
    }   
       
    /* ·¢Ò»×Ö½ÚÊı¾İµ½6311  ²ÎÊı PAR_T */   
    void disp_6311()    
    {   
      uchar i;   
      for(i=0;i<8;i++)   
        {   
          bc_clk_6311=0;   
          bc_data_6311=par_t_0;   
          par_t=par_t>>1;   
          some_nop();   
          bc_clk_6311=1;   
          some_nop();   
        }    
      bc_data_6311=1;   
      bc_clk_6311=1;   
    }   
       
       
    void sw_6311()   
    {   
      uchar i;   
      bc_stb_6311=0;      // ready to send data to pt6311 STB   
      some_nop();   
      par_t=0x43;        // 0000,1100=0CH 13G,15P   
      disp_6311();       //  send command to pt6311,here is set displayer mod,11dig/17seg   
      some_nop();   
      par[0]=0;   
      for(i=0;i<8;i++)  /* 6311 ¶ÁSWÖµ */   
        {   
          bc_clk_6311=1;    
          bc_data_6311=1;   
          some_nop();   
          bc_clk_6311=0;    
          some_nop();   
          if(bc_data_6311==1)   par[0]++;   
        }     
      bc_stb_6311=1;     
    }   
       
       
    void some_nop()   
    {   
      _nop_(); _nop_(); _nop_();   
    } 

Sdttn

#6
Başak bir kod daha.

/*
 *
 * Copyright (c) hivision, Inc. 2006. All rights reserved.
 *
 */

/**
 * @file public.c
 * @Sample FIP user level program to display given string,
 * monitoring eject button and eject disc if needed.
 *
 * @author ZhangHongBo
 */

#include "public.h" 
#include "pt6311.h"


static int vfd_playstatus = 0;
static int vfd_linkstatus = 0;
static int vfd_pcusbstatus = 1;
static int vfd_repeatstatus = 0;
static int vfd_mainstatus = 0;

static int tv_mode = 2;

static int vfd_ON_OFF=0;

// address : 0x00 0x01
//////////////////////////////////////////////////////////////////////
static const int vfd_hour[10] [2] = {
		{DIGIT_L(0,1,0,1,0,1,0,0), DIGIT_H(0,1,0,1,0,1,1,0)},		//0
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,0,1,0)},		// 1
		{DIGIT_L(0,1,0,1,0,0,0,1), DIGIT_H(0,0,0,1,0,1,1,0)},		// 2	
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,0,0,1,0,1,1,0)},		// 3
		{DIGIT_L(0,0,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,0,1,0)},		// 4
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,0,0,1,1,0)},		// 5
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,0,0,1,1,0)},		// 6
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,1,1,0)},		// 7
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,1,0,1,1,0)},		// 8
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,1,1,0)}		// 9
};

static const int vfd_min_high[7][2] = {

		{DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,1,0)},		//0
		{DIGIT_L(0,0,0,0,1,0,0,0), DIGIT_H(0,0,1,0,0,0,1,0)},		// 1
		{DIGIT_L(1,0,1,0,0,0,1,0), DIGIT_H(0,0,1,0,1,0,1,0)},		// 2	
		{DIGIT_L(1,0,0,0,1,0,1,0), DIGIT_H(0,0,1,0,1,0,1,0)},		// 3
		{DIGIT_L(0,0,0,0,1,0,1,0), DIGIT_H(1,0,1,0,0,0,1,0)},		// 4
		{DIGIT_L(1,0,0,0,1,0,1,0), DIGIT_H(1,0,0,0,1,0,1,0)},		// 5
		{DIGIT_L(1,0,1,0,1,0,1,0), DIGIT_H(1,0,0,0,1,0,1,0)}		// 6
};
// address : 0x03 0x04
//////////////////////////////////////////////////////////////////////
static const int vfd_min_low[10] [2] = {
		{DIGIT_L(0,1,0,1,0,1,0,0), DIGIT_H(0,1,0,1,0,1,1,0)},		//0
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,0,1,0)},		// 1
		{DIGIT_L(0,1,0,1,0,0,0,1), DIGIT_H(0,0,0,1,0,1,1,0)},		// 2	
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,0,0,1,0,1,1,0)},		// 3
		{DIGIT_L(0,0,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,0,1,0)},		// 4
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,0,0,1,1,0)},		// 5
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,0,0,1,1,0)},		// 6
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,1,1,0)},		// 7
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,1,0,1,1,0)},		// 8
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,1,1,0)}		// 9
};
		
static const int vfd_sec_high[7][2] = {

		{DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,1,0)},		//0
		{DIGIT_L(0,0,0,0,1,0,0,0), DIGIT_H(0,0,1,0,0,0,1,0)},		// 1
		{DIGIT_L(1,0,1,0,0,0,1,0), DIGIT_H(0,0,1,0,1,0,1,0)},		// 2	
		{DIGIT_L(1,0,0,0,1,0,1,0), DIGIT_H(0,0,1,0,1,0,1,0)},		// 3
		{DIGIT_L(0,0,0,0,1,0,1,0), DIGIT_H(1,0,1,0,0,0,1,0)},		// 4
		{DIGIT_L(1,0,0,0,1,0,1,0), DIGIT_H(1,0,0,0,1,0,1,0)},		// 5
		{DIGIT_L(1,0,1,0,1,0,1,0), DIGIT_H(1,0,0,0,1,0,1,0)}		// 6
};
// address : 0x06 0x07
//////////////////////////////////////////////////////////////////////
static const int vfd_sec_low[10] [2] = {
		{DIGIT_L(0,1,0,1,0,1,0,0), DIGIT_H(0,1,0,1,0,1,0,0)},		//0
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,0,0,0)},		// 1
		{DIGIT_L(0,1,0,1,0,0,0,1), DIGIT_H(0,0,0,1,0,1,0,0)},		// 2	
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,0,0,1,0,1,0,0)},		// 3
		{DIGIT_L(0,0,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,0,0,0)},		// 4
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,0,0,1,0,0)},		// 5
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,0,0,1,0,0)},		// 6
		{DIGIT_L(0,0,0,0,0,1,0,0), DIGIT_H(0,0,0,1,0,1,0,0)},		// 7
		{DIGIT_L(0,1,0,1,0,1,0,1), DIGIT_H(0,1,0,1,0,1,0,0)},		// 8
		{DIGIT_L(0,1,0,0,0,1,0,1), DIGIT_H(0,1,0,1,0,1,0,0)}		// 9
};

static const int vfd_tvip[7][2] = {
		{DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,0,1)},		//0 i
		{DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,1,0)},		// 1 p	
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,0,0)},		// 2 none
		{DIGIT_L(1,0,1,0,1,0,1,0), DIGIT_H(1,0,0,0,1,0,0,1)},          //6 i
		{DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,0,0)},          // 0
		{DIGIT_L(0,0,0,0,1,0,1,0), DIGIT_H(1,0,1,0,0,0,0,0)},           // 4
		{DIGIT_L(1,0,1,0,1,0,1,0), DIGIT_H(1,0,1,0,1,0,0,0)}          // 8
};
// address : 0x09 0x0a
//////////////////////////////////////////////////////////////////////
static const int vfd_tvmode[3][2] = {
		{DIGIT_L(1,0,1,0,1,1,1,1), DIGIT_H(1,1,1,1,1,0,0,0)},		//480
		{DIGIT_L(1,0,1,0,0,1,1,0), DIGIT_H(0,0,1,1,1,1,0,0)},		//720	
		{DIGIT_L(1,1,1,1,1,1,1,0), DIGIT_H(1,1,1,1,1,1,1,1)}		//1080
};
//////////////////////////////////////////////////////////////////
static const int vfd_vgaip[4][2]={
	        {DIGIT_L(1,0,1,0,1,0,0,0), DIGIT_H(1,0,1,0,1,0,0,0)},  // 0
               {DIGIT_L(0,0,0,0,1,0,1,0),DIGIT_H(1,0,1,0,0,0,0,0)},  // 4   
		 {DIGIT_L(1,0,1,0,1,0,1,0),DIGIT_H(1,0,1,0,1,0,0,0)},  // 8
		 {DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,0,0)}    // none
};
static const int vfd_vgamode[6][2]={
	        {DIGIT_L(1,0,1,0,1,1,1,1),DIGIT_H(1,1,1,1,1,0,0,0)}, //480
	        {DIGIT_L(1,1,1,1,1,1,0,1),DIGIT_H(1,1,1,0,1,1,0,0)},  //600
	        {DIGIT_L(1,0,1,0,1,1,1,0),DIGIT_H(1,0,0,1,1,1,0,0)},   //768
	        {DIGIT_L(1,1,1,1,0,1,1,0),DIGIT_H(0,1,1,1,1,1,0,1)},    //1024
	        {DIGIT_L(1,1,1,1,1,0,0,1),DIGIT_H(1,0,1,1,1,1,0,1)},    //1200
	        {DIGIT_L(0,1,0,0,1,1,0,1),DIGIT_H(0,1,1,0,1,1,0,0)}     //576
};
////////////////////////////////////////////////////////////////////
// address : 0x0c 0x0d
//////////////////////////////////////////////////////////////////////
static const int vfd_hd_green[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,1,0,1,0,1,0)},		//none
		{DIGIT_L(0,0,0,0,0,0,0,1), DIGIT_H(1,0,1,0,1,0,1,0)},		//photo
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,1,0,1,0,1,1)},		//movie
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,1,1,0,1,0,0,0)}		//music
};

static const int vfd_hd_blue[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,1,0,1,1,0)},
		{DIGIT_L(0,0,0,0,0,0,0,1), DIGIT_H(1,0,0,1,0,1,1,0)},		//photo
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,1,0,1,1,1)},		//movie
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,1,0,1,0,1,0,0)}		//music
};

static const int vfd_hd_s[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,1,0,0,0,0,0)},		//S1
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,0,0,1,0,0)},		//S2
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,0,1,0,0,0)},		//S3
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,1,0,0,0,0)}		//S4
};

static const int vfd_mainmode[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,1,0)},
		{DIGIT_L(0,0,0,0,0,0,0,1), DIGIT_H(0,0,0,0,0,0,1,0)},		//photo
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,1,1)},		//movie
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,1,0,0,0,0,1,0)}		//music

};


// address : 0x0f 0x10
//////////////////////////////////////////////////////////////////////
static const int vfd_pcusb[2][2]= {
	{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,1,1)},			//pc usb
	{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,0,0)}			//&0xf7
};

static const int vfd_playmode[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,1,1,0)},		//play
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,1,0,1,0)},		//pause
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,1,0,0,1,0)},		//stop
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,0,0,0,0,1,0)}		//nomode
};

static const int vfd_repeat[2][2]= {
	{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,0,1,0,0,0,1,0)},			//pc usb
	{DIGIT_L(1,1,1,1,1,1,1,1), DIGIT_H(1,1,0,1,1,1,1,1)}			//&0xf7
};

static const int vfd_link[4][2] = {
		{DIGIT_L(0,0,0,0,0,0,1,0), DIGIT_H(0,0,0,0,0,0,1,0)},		//hd
		{DIGIT_L(0,0,0,0,0,0,0,1), DIGIT_H(0,0,0,0,0,0,1,0)},		//usb1
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(0,1,0,0,0,0,1,0)},		//usb2
		{DIGIT_L(0,0,0,0,0,0,0,0), DIGIT_H(1,0,0,0,0,0,1,0)}		//network
};
//////////////////////////////////////////////////////////////////////


void set_vfd_playstatus(int status)
{
	vfd_playstatus = status;
}


void set_vfd_linkstatus(int status)
{
	vfd_linkstatus = status;
}

void set_vfd_pcusbstatus(int status)
{
	vfd_pcusbstatus = status;
}

void set_vfd_repeatstatus(int status)
{
	vfd_repeatstatus = status;
}

void set_vfd_mainstatus(int status)
{
	vfd_mainstatus = status;
}

void vfd_delay_ms(unsigned long time)
{
	unsigned long i;
	for(i=0;i<time*10;i++);
}


void PD6311_WRITE(int reg_data)
{
	int i;
	
	for ( i = 0; i <8; i++ ) {
		
		if((reg_data >> i) & 0x01)
			  em86xx_gpio_write(PD6311_DIN,1);
		else 
			em86xx_gpio_write(PD6311_DIN,0);

		em86xx_gpio_write(PD6311_CLK,1);
		vfd_delay_ms(100);
		em86xx_gpio_write(PD6311_CLK,0);
		vfd_delay_ms(100);
	}
		

	
}

void VFD_DisplayMode(int mode)
{

   em86xx_gpio_setdirection(PD6311_STB,1);
   em86xx_gpio_setdirection(PD6311_DIN,1);
   em86xx_gpio_setdirection(PD6311_CLK,1);
   delay_ms(200);
   em86xx_gpio_write(PD6311_STB,0);	
   PD6311_WRITE(0x44);
   em86xx_gpio_write(PD6311_STB,1);	

/////////////////////////////////////////////////////////
   switch(mode)
   	{
   	case VFD_DISPLAY_PC:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   
		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[0][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[vfd_linkstatus][1]);	
		   else
		   	PD6311_WRITE(vfd_pcusb[0][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);	
		   
		   em86xx_gpio_write(PD6311_STB,1);	
		   vfd_pcusbstatus= 0;
		   break;
	case VFD_DISPLAY_PCOUT:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   
		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE((vfd_pcusb[1][1]&vfd_playmode[vfd_playstatus][1])|vfd_repeat[vfd_repeatstatus][1]|vfd_link[vfd_linkstatus][1]);		
		   else
		   	PD6311_WRITE((vfd_pcusb[1][1]&vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);		

		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_pcusbstatus= 1;
		   break;
	case VFD_DISPLAY_HD:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   
		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[0][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[0][1]);		

		   em86xx_gpio_write(PD6311_STB,1);
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_link[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_linkstatus = 0;
		   break;
	case VFD_DISPLAY_USB1:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);

		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[1][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[1][1]);		


		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_link[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_linkstatus = 1;
		   break;
	case VFD_DISPLAY_USB2:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);

		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[2][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[2][1]);	

		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_link[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);
		    vfd_linkstatus = 2;
		   break;
	case VFD_DISPLAY_NETWORK:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);

		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[3][1]);
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[3][1]);

		   em86xx_gpio_write(PD6311_STB,1);
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_link[3][0]);		
		   em86xx_gpio_write(PD6311_STB,1);
		    vfd_linkstatus = 3;
		   break;		   
   	case VFD_DISPLAY_REPEAT:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[vfd_playstatus][1]|vfd_repeat[0][1]|vfd_link[vfd_linkstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_repeatstatus = 0;
		   break;
	case VFD_DISPLAY_REPEATOFF:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[vfd_playstatus][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_repeatstatus = 1;
		   break;		
   	case VFD_DISPLAY_PLAY:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   
		   delay_ms(100);
		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[0][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[vfd_linkstatus][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[0][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);		

		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_playstatus = 0;
		   break;
   	case VFD_DISPLAY_PAUSE:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);

		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[1][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[vfd_linkstatus][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[1][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);		

		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_playstatus = 1;
		   break;
   	case VFD_DISPLAY_STOP:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS6_H|0xc0);
		   delay_ms(100);
		   if(vfd_repeatstatus == 0)
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|vfd_playmode[2][1]|vfd_repeat[vfd_repeatstatus][1]|vfd_link[vfd_linkstatus][1]);		
		   else
		   	PD6311_WRITE(vfd_pcusb[vfd_pcusbstatus][1]|(vfd_playmode[2][1]&vfd_repeat[1][1])|vfd_link[vfd_linkstatus][1]);		

		   em86xx_gpio_write(PD6311_STB,1);
		   vfd_playstatus = 2;
		   break;	
///////////////////////////////////////////////////////////////////
	case VFD_DISPLAY_NOMODE:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);	
		   vfd_playstatus = 3;
		   break;	



	case VFD_DISPLAY_PHOTO:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);	
		   vfd_mainstatus =1;
		   break;	


	case VFD_DISPLAY_MOVIE:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[2][1]);		
		   em86xx_gpio_write(PD6311_STB,1);	
		   vfd_mainstatus = 2;
		   break;		

	case VFD_DISPLAY_MUSIC:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[3][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[3][1]);		
		   em86xx_gpio_write(PD6311_STB,1);	
		   vfd_mainstatus = 3;
		   break;	

	case VFD_DISPLAY_ROUNDG:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_green[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_ROUNDB:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_blue[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_blue[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_ROUNDS1:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[0][0]|vfd_mainmode[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[0][1]|vfd_mainmode[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	
		   
	case VFD_DISPLAY_ROUNDS2:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[1][0]|vfd_mainmode[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[1][1]|vfd_mainmode[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	
	case VFD_DISPLAY_ROUNDS3:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[2][0]|vfd_mainmode[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[2][1]|vfd_mainmode[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;			   
	case VFD_DISPLAY_ROUNDS4:
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[3][0]|vfd_mainmode[vfd_mainstatus][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS5_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_hd_s[3][1]|vfd_mainmode[vfd_mainstatus][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;			   
//////////////////////////////////////////////////////////////
	case VFD_DISPLAY_480I:
		   tv_mode = 0;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_480P:
		   tv_mode = 1;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	


	case VFD_DISPLAY_720I:
		  tv_mode= 0;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_720P:
		  tv_mode = 1;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_1080I:
		 tv_mode = 0;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[2][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_1080P:
		tv_mode =1;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvmode[2][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	
		   
	case VFD_DISPLAY_VGA_480:
		 tv_mode =4;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_VGA_600:
		  tv_mode =4;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_VGA_768:
		tv_mode =6;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[2][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[2][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[2][1]);		
		   em86xx_gpio_write(PD6311_STB,1);	   
		   break;	

	case VFD_DISPLAY_VGA_1024:
		tv_mode =5;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[3][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[3][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[1][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[1][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_VGA_1200:
		tv_mode =4;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[4][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[4][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgaip[0][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	

	case VFD_DISPLAY_576I:
		tv_mode =3;
		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[5][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS4_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_vgamode[5][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_L|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[3][0]);		
		   em86xx_gpio_write(PD6311_STB,1);

		   delay_ms(100);
		   em86xx_gpio_write(PD6311_STB,0);
		   PD6311_WRITE(DIGITS3_H|0xc0);
		   delay_ms(100);
		   PD6311_WRITE(vfd_tvip[3][1]);		
		   em86xx_gpio_write(PD6311_STB,1);		   
		   break;	
		   
   	}
/////////////////////////////////////////////////////////		
   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x0b);
   em86xx_gpio_write(PD6311_STB,1);
   

   
   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x8e);
   em86xx_gpio_write(PD6311_STB,1);
}


void VFD_DisplayTime(unsigned char hour,unsigned char min,unsigned char sec)
{
	
   int min_high, min_low, sec_high, sec_low;
   int tvmode = tv_mode;
   min_high = min/10;
   min_low = min%10;
   sec_high = sec/10;
   sec_low = sec%10;

   em86xx_gpio_setdirection(PD6311_STB,1);
   em86xx_gpio_setdirection(PD6311_DIN,1);
   em86xx_gpio_setdirection(PD6311_CLK,1);
   delay_ms(200);
   em86xx_gpio_write(PD6311_STB,0);	
   PD6311_WRITE(0x44);
   em86xx_gpio_write(PD6311_STB,1);	

/////////////////////////////////////////////////////////
   
   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x00|0xc0);
   delay_ms(100);
   PD6311_WRITE((vfd_hour[hour][0]|vfd_min_high[min_high][0]));		
   em86xx_gpio_write(PD6311_STB,1);

   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x01|0xc0);
   delay_ms(100);
   PD6311_WRITE((vfd_hour[hour][1])|(vfd_min_high[min_high][1]));		
   em86xx_gpio_write(PD6311_STB,1);

   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x03|0xc0);
   delay_ms(100);
   PD6311_WRITE((vfd_min_low[min_low][0])|(vfd_sec_high[sec_high][0]));	
   em86xx_gpio_write(PD6311_STB,1);


   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x04|0xc0);
   delay_ms(100);
   PD6311_WRITE((vfd_min_low[min_low][1]|vfd_sec_high[sec_high][1]));		
   em86xx_gpio_write(PD6311_STB,1); 


   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x06|0xc0);
   delay_ms(100);
   PD6311_WRITE((vfd_sec_low[sec_low][0]|vfd_tvip[tvmode][0]));		
   em86xx_gpio_write(PD6311_STB,1);   

   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x07|0xc0);
   delay_ms(100);
    PD6311_WRITE((vfd_sec_low[sec_low][1]|vfd_tvip[tvmode][1]));			
   em86xx_gpio_write(PD6311_STB,1);   

/////////////////////////////////////////////////////////		
   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x0b);
   em86xx_gpio_write(PD6311_STB,1);
   

   
   delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x8e);
   em86xx_gpio_write(PD6311_STB,1);
}


void PD6311_Init(void)
{
	int i=0;

   em86xx_gpio_setdirection(PD6311_STB,1);
   em86xx_gpio_setdirection(PD6311_DIN,1);
   em86xx_gpio_setdirection(PD6311_CLK,1);
   vfd_delay_ms(200);
   em86xx_gpio_write(PD6311_STB,0);	
   PD6311_WRITE(0x40);
   em86xx_gpio_write(PD6311_STB,1);

   vfd_delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0xc0);
   
   vfd_delay_ms(100);
   for(i=0;i<48;i++)
   	{
   vfd_delay_ms(100);
   PD6311_WRITE(0x00);
   
   	}
   em86xx_gpio_write(PD6311_STB,1);


   vfd_delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x0b);
   em86xx_gpio_write(PD6311_STB,1);
   

   
   vfd_delay_ms(100);
   em86xx_gpio_write(PD6311_STB,0);
   PD6311_WRITE(0x8e);
   em86xx_gpio_write(PD6311_STB,1);
}

void PD6311_SetSW(void)
{
	//int i=0;

  em86xx_gpio_setdirection(PD6311_STB,1);
  em86xx_gpio_setdirection(PD6311_DIN,1);
  em86xx_gpio_setdirection(PD6311_CLK,1);
  
   delay_ms(200);
   em86xx_gpio_write(PD6311_STB,0);	
   PD6311_WRITE(0x41);		//commod 2
   delay_ms(100);
   if(vfd_ON_OFF == 0)
   {
      PD6311_WRITE(0x00);
      vfd_ON_OFF = 1;
   }
   else
   {
      PD6311_WRITE(0x01);
      vfd_ON_OFF = 0;	  
   }
   em86xx_gpio_write(PD6311_STB,1);

}

void PD6311_OFF(unsigned int On_Off)
{
	//int i=0;

  em86xx_gpio_setdirection(PD6311_STB,1);
  em86xx_gpio_setdirection(PD6311_DIN,1);
  em86xx_gpio_setdirection(PD6311_CLK,1);
  
   delay_ms(200);
   em86xx_gpio_write(PD6311_STB,0);	
   PD6311_WRITE(0x41);		//commod 2
   delay_ms(100);   
    if(On_Off== 1)   
       PD6311_WRITE(0x00);       
   else  
       PD6311_WRITE(0x01);      
  
   em86xx_gpio_write(PD6311_STB,1);

}

void Check_Playing(void)
{
   #if 0
    em86xx_gpio_write(3,1);
   #endif
}

void Check_Stop(void)
{
	#if 0
    em86xx_gpio_write(3,0);
	#endif
}


Header file PT6311.h

/*****************************************
 *  Copyright (c) 2006
 *  HIVISION, Inc. All Rights Reserved
 *  Modified for KiSS Front Panel support
 *  Proprietary and Confidential
 ******************************************/
                                                                                

#ifndef _PT6311_H_
#define _PT6311_H_

#define PD6311_STB    		4
#define PD6311_CLK		5
#define PD6311_DIN		2
#define PD6311_DOUT		3

#define VFD_DISPLAY 	1
#define VFD_CLOSE		0

#define DIGIT_L(v2d,v1d,v2e,v1e,v2c,v1c,v2g,v1g)	((v1g << 7) | (v2g << 6) | (v1c << 5) | (v2c << 4) | (v1e << 3) | (v2e << 2) | (v1d << 1) | v2d)
#define DIGIT_H(v2f,v1f,v2b,v1b,v2a,v1a,vcol,vq)	((vq << 7) | (vcol << 6) | (v1a << 5) | (v2a << 4) | (v1b << 3) | (v2b << 2) | (v1f << 1) | v2f)

#define DIGITS1_L 	0x00
#define DIGITS1_H 	0x01
#define DIGITS2_L 	0x03
#define DIGITS2_H 	0x04
#define DIGITS3_L 	0x06
#define DIGITS3_H 	0x07
#define DIGITS4_L 	0x09
#define DIGITS4_H 	0x0a
#define DIGITS5_L	0x0c
#define DIGITS5_H 	0x0d
#define DIGITS6_L	0x0f
#define DIGITS6_H 	0x10





enum Display
{
	VFD_DISPLAY_PC = 0,
	VFD_DISPLAY_PCOUT ,
	VFD_DISPLAY_POWER,
	VFD_DISPLAY_HD,   //3//3
	VFD_DISPLAY_USB1,
	VFD_DISPLAY_USB2,
	VFD_DISPLAY_NETWORK,
	VFD_DISPLAY_PLAY,
	VFD_DISPLAY_PAUSE,
	VFD_DISPLAY_STOP,
	VFD_DISPLAY_REPEAT,
	VFD_DISPLAY_REPEATOFF,
	VFD_DISPLAY_MOVIE,
	VFD_DISPLAY_MUSIC,
	VFD_DISPLAY_NOMODE,
	VFD_DISPLAY_PHOTO,
	VFD_DISPLAY_480I,
	VFD_DISPLAY_480P,
	VFD_DISPLAY_720I,
	VFD_DISPLAY_720P,
	VFD_DISPLAY_1080I,
	VFD_DISPLAY_1080P,
	VFD_DISPLAY_ROUNDG,
	VFD_DISPLAY_ROUNDB,	
	VFD_DISPLAY_ROUNDS1,
	VFD_DISPLAY_ROUNDS2,
	VFD_DISPLAY_ROUNDS3,
	VFD_DISPLAY_ROUNDS4,
	VFD_DISPLAY_VGA_480,
	VFD_DISPLAY_VGA_600,
	VFD_DISPLAY_VGA_768,
	VFD_DISPLAY_VGA_1024,
	VFD_DISPLAY_VGA_1200,
	VFD_DISPLAY_576I
};

void set_vfd_playstatus(int status);


void set_vfd_linkstatus(int status);


void set_vfd_pcusbstatus(int status);


void set_vfd_repeatstatus(int status);


void set_vfd_mainstatus(int status);



void PD6311_WRITE(int reg_data);
void PD6311_Init(void);
void PD6311_SetSW(void);
void PD6311_OFF(unsigned int On_Off);
void vfd_delay_ms(unsigned long time);
void VFD_DisplayMode(int mode);
void VFD_DisplayTime(unsigned char hour,unsigned char min,unsigned char sec);

void Check_Playing(void);
void Check_Stop(void);
#endif /* _PT6311_H_ */



Edit:Kodlar bilgisyar (linux) için yazılmış ama karakter oluşturma nasıl yapılıyor çözümlenebilir gibi geliyor bana
fakat C bilmiyorum.

Sdttn

Bu entegre ile uğraşmaktan vazgeçtim.

Tarama yöntemiyle süreceğim displayleri. Ancak pic çıkışındaki 5 V'u 20-24 volta çıkarmam gerekiyor.
Bunu nasıl yaparım?

Sdttn

Alıntı yapılan: FxDev - 08 Temmuz 2011, 00:10:56

ULN2003

Öneri için teşekkürler.
PT6311 ile uğraşmaktan vazgeçtiğim için yeni konu açtım. Buradan devam edelim.
https://www.picproje.org/index.php/topic,34360.0.html