TV-Tuner už 89c2051.

Z

z543g

Guest
SAA1064 & TV-Tuner KODAS.

naudoti 's IAR c comiler.Jūs have't padėti.

sėkmingas!gera c šaltinio funkciją.

* I2c autobusu funkcija.

tuščia i2c_start ();
tuščia i2c_stop ();
int i2c_clock ();
int i2c_ack ();
int i2c_read ();
int i2c_write (char duomenys);

* Saa1064 funkcija
tuščia disp_led (unsigned int index, unsigned char count);

* TV-Tuner (tsa5520) funkcija
tuščia Tuner (unsigned int juostos, unsigned char count);
/ * Bs1 produkcija - CH2 ~ 5 * /
/ * BS2 produkcija - CH6 ~ 20 * /
/ * Bs3 produkcija - ch21 ~ 40 * /
/ * Bs4 produkcija - CH41 ~ 69 * /

galima kabeliu funkcija.

* T_cp, t_plus, t_minus funkcija
tuščia key_in ();

* Vaizdo dekoderis funkcija (naudoti kabelį)
tuščia v_decoder (unsigned char VAL1, unsigned char VAL2);ha!ha!ha!ha!pabaigos .....

 
<img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Labai laimingas" border="0" />/************************************************* *****/
/ * SAA1064 LED display & TV TUNER PROGRAMA * /
/ * * /
/ * * /
/ * Http://kms2000.wo.to tun_led.c (IAR V5.0) * /
/ * Http://www.woe.de.vu tun_led.asm * /
/ * * /
/ * C Langage programuotojas: Kang Yong Koo (z543g) * /
/ * Data: 2002/5/6 * /
/************************************************* *****/

#
include <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 rhn * /
0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x73, 0x50, 0x74);

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

/ * 0 (nenaudoti) 1 (nenaudoti) 2 CH 3 ch * /
char 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));

statinio unsigned char i2c_nackcount = 0;
statinio unsigned int prog_index;
statinio unsigned int ch_index;
statinio unsigned int get_idx;

statinio unsigned char key_in;

statinio unsigned 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 / * - * /

tuščia delay_ms (int t)
(
o (t -);
)

tuščia i2c_start (tuščia)
(
I2C_SDA = 1;
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 0;
delay_ms (1);
)

tuščia i2c_stop (tuščia)
(
I2C_SDA = 0;
delay_ms (1);
I2C_SCL = 1;
delay_ms (1);
I2C_SDA = 1;
delay_ms (1);
)

int i2c_clock (tuščia)
(
unsigned int sda_value;

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

return (sda_value);
)

int i2c_ack (tuščia)
(
unsigned 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);

return (count);
)

int i2c_read (tuščia)
(
unsigned char duomenų skaičius, b;

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

tuščia i2c_write (unsigned char b)
(
unsigned char duomenų skaičius;

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

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

i2c_ack ();
)

/ *
tuščia store_eeprom (unsigned char eep_data1, unsigned 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 ();
)
* /

tuščia disp_led (int num, unsigned char disp_num)
(
unsigned char disp [1];
unsigned char skaičius;

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

switch (num) (
case 0:
disp [0] = (disp_num% 10);
count = disp [0];
i2c_write (disp_tab [skaičius]);

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

i2c_write (disp_tab [17]), "r"
i2c_write (disp_tab [16]), "P"
break;
case 1:
disp [0] = (disp_num% 10);
count = disp [0];
i2c_write (disp_tab [skaičius]);

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

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

tuščia Tuner (unsigned char data_code)
(
int i, skaičius;

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] [skaičius]);
i2c_stop ();
)

tuščia delay2 ()
(
int i, j;

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

void main (void)
(
int count;

prog_index = 0;
ch_index = 2;

disp_led (skaičius, prog_index);
Tuner (ch_index);

o (1) (
key_in = ~ P1;

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

if (count) (
disp_led (skaičius, ch_index);
Tuner (ch_index);
jei (key_in == T_PLUS) (
jei (ch_index <6) ch_index ; dar ch_index = 2;
get_idx = ch_index;
delay2 ();
)
jei (key_in == T_MINUS) (
jei (ch_index> 2) ch_index -; dar ch_index = 6;
get_idx = ch_index;
delay2 ();
)
) Else (
disp_led (skaičius, prog_index);
jei (key_in == T_PLUS) (
jei (prog_index <10) prog_index ; dar prog_index = 0;
delay2 ();
)
jei (key_in == T_MINUS) (
jei (prog_index> 0) prog_index -; dar prog_index = 10;
delay2 ();
)
)
)
)

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

Welcome to EDABoard.com

Sponsor

Back
Top