tv-tuner za 89c2051.

Z

z543g

Guest
SAA1064 & TV-tuner CODE.

Uporaba je IAR c comiler.ste have't pomoč.

uspešno!dober vir c funkcijo.

* I2c-bus funkcijo.

neveljaven i2c_start ();
neveljaven i2c_stop ();
int i2c_clock ();
int i2c_ack ();
int i2c_read ();
int i2c_write (char data);

* Saa1064 funkcijo
neveljaven disp_led (nepodpisanih int indeks, nepotpisani char count);

* TV-tuner (tsa5520) funkcijo
neveljaven tuner (nepodpisanih int pasu, nepotpisani char count);
/ * Bs1 output - CH2 ~ 5 * /
/ * Bs2 output - ch6 ~ 20 * /
/ * Bs3 output - ch21 ~ 40 * /
/ * Bs4 output - ch41 ~ 69 * /

mogoče kabel funkcijo.

* T_cp, t_plus, t_minus funkcijo
neveljaven key_in ();

* Video dekoder funkcijo (uporabite kabel)
neveljaven v_decoder (nepodpisanih char VAL1, nepotpisani VAL2 char);ha!ha!ha!ha!konec .....

 
<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 LED DISPLAY & TV-TUNER PROGRAM * /
/ * * /
/ * * /
/ * Http://kms2000.wo.to tun_led.c (IAR v5.0) * /
/ * Http://www.woe.de.vu tun_led.asm * /
/ * * /
/ * C-langage programer: Kang Yong Koo (z543g) * /
/ * Date: 2002/5/6 * /
/************************************************* *****/

# vključujejo <io51.h>

/***** Saa1064 Led Display Code_Table *****/

/ * 0 1 2 3 4 5 6 7 8 9 * /
char disp_tab [] = (0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f,
/ * A B C D E F P rh * /
0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x73, 0x50, 0x74);

/***** TV tuner Samsung TCPN7082PC27A (TSA5520) Code_Table *****/

/ * 0 (ne uporabe), 1 (ne uporabe) 2 CH 3 CH * /
char freq_tab [] [4] = ((0x00, 0x00, 0x00), (0x00, 0x00, 0x00), (0x06, 0x60, 0x01), (0x06, 0xaf, 0x01);
/ * 4 CH 5 ch ch 20 * /
(0x07, 0x0f, 0x01), (0x07, 0x5f, 0x01), (0x1f, 0xe2, 0x08));

statični nepotpisani char i2c_nackcount = 0;
statični nepotpisani int prog_index;
statični nepotpisani int ch_index;
statični nepotpisani int get_idx;

statični nepotpisani char key_in;

statični nepotpisani 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 / * - * /

neveljaven delay_ms (int t)
(
medtem ko (t -);
)

i2c_start neveljaven (ničen)
(
I2C_SDA = 1;
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 0;
delay_ms (1);
)

i2c_stop neveljaven (ničen)
(
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 1;
delay_ms (1);
)

int i2c_clock (ničen)
(
nepotpisani int sda_value;

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

vrnitev (sda_value);
)

int i2c_ack (ničen)
(
nepotpisani 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);

vrnitev (count);
)

int i2c_read (ničen)
(
nepotpisani char count podatkov, b;

for (count = 0; count <= 7; count ) (
I2C_SDA = 1;
b = b <<1;
b | = i2c_clock ();
)
vrnitev (b);
)

neveljaven i2c_write (nepodpisanih char b)
(
nepodpisanih podatkov char count;

for (count = 0; count <= 7; count ) (
if ((b & 0x80) == 0)
I2C_SDA = 0;
še
I2C_SDA = 1;

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

i2c_ack ();
)

/ *
neveljaven store_eeprom (nepodpisanih char eep_data1, nepodpisane char 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 ();
)
* /

neveljaven disp_led (int num, char nepotpisani disp_num)
(
nepotpisani char DISP [1];
nepotpisani char count;

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

stikalo (num) (
primeru 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"
odmor,
primer 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"
odmor,
default: break;
)
i2c_stop ();
)

neveljaven tuner (nepodpisanih char data_code)
(
int i, count;

i2c_start ();
i2c_write (0xc2);

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

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

neveljaven delay2 ()
(
int i, j;

for (i = 0; i <150; i ) (
for (j = 0; j <150; j );
)
)

neveljaven glavne (neveljaven)
(
int count;

prog_index = 0;
ch_index = 2;

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

medtem ko (1) (
key_in ~ = P1;

if (key_in == T_CP) (
if (count <1) count ; drugje count = 0;
delay2 ();
)

if (count) (
disp_led (count, ch_index);
tuner (ch_index);
if (key_in == T_PLUS) (
if (ch_index <6) ch_index ; drug ch_index = 2;
get_idx = ch_index;
delay2 ();
)
if (key_in == T_MINUS) (
if (ch_index> 2) ch_index -; drug ch_index = 6;
get_idx = ch_index;
delay2 ();
)
Drug ()
disp_led (count, prog_index);
if (key_in == T_PLUS) (
if (prog_index <10) prog_index ; drug prog_index = 0;
delay2 ();
)
if (key_in == T_MINUS) (
if (prog_index> 0) prog_index -; drug 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