tv-apinador para sa 89c2051.

Z

z543g

Guest
SAA1064 & TV-apinador CODE.

gamitin ang 's iar c comiler.ikaw have't tulong.

matagumpay!magandang c source function.

* I2c-bus function.

magpawalang-bisa i2c_start ();
magpawalang-bisa i2c_stop ();
int i2c_clock ();
int i2c_ack ();
int i2c_read ();
int i2c_write (magpasinda data);

* Saa1064 function
magpawalang-bisa disp_led (hindi linagdaan int index, hindi linagdaan magpasinda count);

* Tv-apinador (tsa5520) function
magpawalang-bisa apinador (hindi linagdaan int band, hindi linagdaan magpasinda count);
/ * Bs1 output - ch2 ~ 5 * /
/ * Bs2 output - ch6 ~ 20 * /
/ * Bs3 output - ch21 ~ 40 * /
/ * Bs4 output - ch41 ~ 69 * /

posible cable function.

* T_cp, t_plus, t_minus function
magpawalang-bisa key_in ();

* Video decoder function (gamitin ang cable)
magpawalang-bisa v_decoder (hindi linagdaan magpasinda VAL1, hindi linagdaan magpasinda val2);ha!ha!ha!ha!end .....

 
<img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" />/************************************************* *****/
/ * SAA1064 humantong display & TV-apinador PROGRAMA * /
/ * * /
/ * * /
/ * Http://kms2000.wo.to tun_led.c (Iar v5.0) * /
/ * Http://www.woe.de.vu tun_led.asm * /
/ * * /
/ * C-langage programista: Kang yong Koo (z543g) * /
/ * Petsa: 2002.5.6 * /
/************************************************* *****/

# isama <io51.h>

/***** Saa1064 humantong Display Code_Table *****/

/ * 0 1 2 3 4 5 6 7 8 9 * /
pansamantalang trabaho disp_tab [] = (0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f,
/ * Ang b C d E f P rh * /
0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x73, 0x50, 0x74);

/***** TV-apinador Samsung TCPN7082PC27A (TSA5520) Code_Table *****/

/ * 0 (hindi gamitin) 1 (hindi gamitin) 2 ch 3 ch * /
pansamantalang trabaho freq_tab [] [4] = ((0x00, 0x00, 0x00), (0x00, 0x00, 0x00), (0x06, 0x60, 0x01), (0x06, 0xaf, 0x01),
/ * 4 ch 5 ch 20 ch * /
(0x07, 0x0f, 0x01), (0x07, 0x5f, 0x01), (0x1f, 0xe2, 0x08));

static na hindi linagdaan magpasinda i2c_nackcount = 0;
static na hindi linagdaan int prog_index;
static na hindi linagdaan int ch_index;
static na hindi linagdaan int get_idx;

static na hindi linagdaan magpasinda key_in;

static na hindi linagdaan int eeprom_count;

# define I2C_SCL P1.0
# define I2C_SDA P1.1

# define T_CP 0x08 / * C ^ P * /
# define T_PLUS 0x10 / * * /
# define T_MINUS 0x20 / * - * /

magpawalang-bisa delay_ms (int t)
(
habang (t -);
)

magpawalang-bisa i2c_start (walang laman)
(
I2C_SDA = 1;
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 0;
delay_ms (1);
)

magpawalang-bisa i2c_stop (walang laman)
(
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 1;
delay_ms (1);
)

int i2c_clock (walang laman)
(
hindi linagdaan int sda_value;

I2C_SCL = 1;
delay_ms (1);
sda_value = I2C_SDA;
I2C_SCL = 0;
delay_ms (1);

bumalik (sda_value);
)

int i2c_ack (walang laman)
(
hindi linagdaan int count;

I2C_SDA = 1;
I2C_SCL = 1;
delay_ms (1);

count = I2C_SDA;

I2C_SCL = 0;
delay_ms (1);
I2C_SDA = 0;
delay_ms (1);

bumalik (count);
)

int i2c_read (walang laman)
(
hindi linagdaan magpasinda data count, b;

para sa (count = 0; count <= 7; count ) (
I2C_SDA = 1;
b = b <<1;
b | = i2c_clock ();
)
bumalik (b);
)

magpawalang-bisa i2c_write (hindi linagdaan magpasinda b)
(
hindi linagdaan magpasinda data count;

para sa (count = 0; count <= 7; count ) (
kung ((b & 0x80) == 0)
I2C_SDA = 0;
kung hindi
I2C_SDA = 1;

b = b <<1;
i2c_clock ();
)

i2c_ack ();
)

/ *
magpawalang-bisa store_eeprom (hindi linagdaan magpasinda eep_data1, hindi linagdaan magpasinda eep_data2)
(

i2c_start ();
i2c_write (0xa0);
eeprom_count = eep_data1;
i2c_write (eeprom_count);
save_idx = eeprom_count;
eeprom_count = eep_data2;
i2c_write (eeprom_count);
get_idx = eeprom_count;
i2c_stop ();
)
* /

magpawalang-bisa disp_led (int num, hindi linagdaan magpasinda disp_num)
(
hindi linagdaan magpasinda disp [1];
hindi linagdaan magpasinda count;

i2c_start ();
i2c_write (0x70);
i2c_write (0x00);
i2c_write (0x37);

lumipat (num) (
kaso 0:
disp [0] = (disp_num% 10);
count = disp [0];
i2c_write (disp_tab [count]);

disp [1] = (disp_num% 100) / 10;
count = disp [1];
i2c_write (disp_tab [count]);

i2c_write (disp_tab [17]); "r"
i2c_write (disp_tab [16]); "P"
break;
kaso 1:
disp [0] = (disp_num% 10);
count = disp [0];
i2c_write (disp_tab [count]);

disp [1] = (disp_num% 100) / 10;
count = disp [1];
i2c_write (disp_tab [count]);

i2c_write (disp_tab [18]); "h"
i2c_write (disp_tab [12]); "C"
break;
default na: break;
)
i2c_stop ();
)

magpawalang-bisa apinador (hindi linagdaan magpasinda data_code)
(
int ako, count;

i2c_start ();
i2c_write (0xc2);

para sa (i = 0; i <1; i ) (
i2c_write (freq_tab [data_code] );
i2c_write (freq_tab [data_code] [i 1]);
count = ako 2;
)
i2c_write (0xce);

i2c_write (freq_tab [data_code] [count]);
i2c_stop ();
)

magpawalang-bisa delay2 ()
(
int i, j;

para sa (i = 0; i <150; i ) (
para sa (j = 0; j <150; j );
)
)

magpawalang-bisa pangunahing (walang laman)
(
int count;

prog_index = 0;
ch_index = 2;

disp_led (count, prog_index);
apinador (ch_index);

habang (1) (
key_in = ~ P1;

kung (key_in == T_CP) (
kung (count <1) count ; iba count = 0;
delay2 ();
)

kung (count) (
disp_led (count, ch_index);
apinador (ch_index);
kung (key_in == T_PLUS) (
kung (ch_index <6) ch_index ; iba ch_index = 2;
get_idx = ch_index;
delay2 ();
)
kung (key_in == T_MINUS) (
kung (ch_index> 2) ch_index -; iba ch_index = 6;
get_idx = ch_index;
delay2 ();
)
) Else (
disp_led (count, prog_index);
kung (key_in == T_PLUS) (
kung (prog_index <10) prog_index ; iba prog_index = 0;
delay2 ();
)
kung (key_in == T_MINUS) (
kung (prog_index> 0) prog_index -; iba prog_index = 10;
delay2 ();
)
)
)
)

<img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" />
 

Welcome to EDABoard.com

Sponsor

Back
Top