Jump to content
ELFORUM - Forumul electronistilor

TEA5767


Recommended Posts

Este vorba de modulul de radio FM din majoritatea telefonelor cu radio, MP3 playr cu radio si altele.Daca nu e exact asta tot din seria asta este.Am vazut ca ar costa in jur de 1$ si ca mai este si stereo. Ce experienta aveti cu el ? Daca ati mai lucrat cu el impartasiti sugetii: merita/ nu merita lucrat cu el? Calitatea sunetului ? Eu am un telefon stricat care contine acest modul (avea radio). Evident comandat de PIC.

Link to comment
  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 months later...
Guest nikc10

Am facut si eu un proiect cu pic 16f876A, lcd 2x16 ce include un radio cu acest cip tea5767. Problema este ca sunt incepator in programare si nu inteleg din programele expuse cum sa fac un program de test cu o frecventa fixa ce o stiu ca merge la radio, sa pot verifica daca porneste acest chip. Partea de program pentru radio arata cam asa:

 

#include <16F876A.h>
#use delay(clock=20000000)    //20000000
#fuses HS,NOWDT,PUT,NOBROWNOUT,NOPROTECT,NOLVP,NOCPD,NOWRT
//************************************************************************************
//#use fast_io(A)
//#use fast_io(B)
#use fast_io©
//************************************************************************************
#include <flex_LCD.c>
 
#define CLOCK_SCL  PIN_C0
#define DATA_SDA   PIN_C1
#use i2c(master, sda=DATA_SDA, scl=CLOCK_SCL)
 
//------------------------------------------variabile-------------------------------------------------//
unsigned int  frequencyH   = 0;  
unsigned int  frequencyL   = 0;    
unsigned int16 frequencyB  = 0;    
unsigned int32 frequency   = 0;
unsigned char byte1, byte2, byte3, byte4, byte5;
 
//************************************************************************************
void pic_init(void)
{
//-- PORTS
   output_A(00000000);
   output_B(00000000);
   output_C(00000000);
   set_tris_A(0b00000000);
   port_B_pullups(true);        
   set_tris_B(0b11001111);
   set_tris_C(0b00000000);
 }
 
 
//-------------------------------------------Program--------------------------------------------------//
void radio_init()
{
  frecvency=103.4   //frecventa radio romania actualitati
 
  frequencyB=4*(frequency*1000000+225000)/32768; 
  frequencyH=frequencyB>>8;
  frequencyL=frequencyB&0XFF;
 
  i2c_start();
  i2c_write(0xC0);
  i2c_write(frequencyH);
  i2c_write(frequencyL);
  i2c_write(0xB0);
  i2c_write(0x10);
  i2c_write(0x00);
  i2c_stop();
 
}
 
 
void radio_citire(unsigned char* byte1, unsigned char* byte2, unsigned char* byte3, unsigned char* byte4, unsigned char* byte5)
{
    i2c_start(); 
    i2c_write(0xC1);
    byte1 = i2c_read(1); 
    byte2 = i2c_read(1); 
    byte3 = i2c_read(1); 
    byte4 = i2c_read(1); 
    byte5 = i2c_read(0);  
    i2c_stop();
 
stereo = (byte3&0x80);
freq = ((((byte1&0x3F)<<8)+byte2)*32768/4-225000)/100000;
signal_level = (byte4 >> 4) * 100 / 16;
}
 
void radio(){
void radio_citire();
 
lcd_gotoxy(1,1);
printf(lcd_putc,"%2.0f %2.0f %2.0f        ",stereo,signal_level,freq);
lcd_gotoxy(1,1);
printf(lcd_putc,"%3.1wMHz  ",frequency);
}
 
void main()
{
pic_init();
display_init();
radio_init();
 
while(true){
radio();
   }
}
 
 
 
Se compileaza programul cu ccs, il copiez in pic, pornesc proiectul , imi afiseaza pe display, dar la iesirea de radio data printr-un amplificator, nu se simte nimic... :84   cateodata se aud ceva pacanituri si cam atat. La antena am un fir de 2m...  As dori putin ajutor daca se poate, sa-mi spuneti unde gresesc. Va multumesc anticipat.
 
linkul dat de thuenderer nu mai e valabil...!

aici e tot acelasi program dar cu mici corecturi...

 

#include <16F876A.h>
#use delay(clock=20000000)    //20000000
#fuses HS,NOWDT,PUT,NOBROWNOUT,NOPROTECT,NOLVP,NOCPD,NOWRT
//************************************************************************************
//#use fast_io(A)
//#use fast_io(B)
#use fast_io©
//************************************************************************************
#include <flex_LCD.c>
 
#define CLOCK_SCL  PIN_C0
#define DATA_SDA   PIN_C1
#use i2c(master, sda=DATA_SDA, scl=CLOCK_SCL)
 
//------------------------------------------variabile-------------------------------------------------//
unsigned int  frequencyH   = 0;  
unsigned int  frequencyL   = 0;    
unsigned int16 frequencyB  = 0;    
unsigned int32 frequency   = 0;
unsigned char byte1, byte2, byte3, byte4, byte5;
float freq, stereo, signal_level;
 
//************************************************************************************
void pic_init(void)
{
//-- PORTS
   output_A(00000000);
   output_B(00000000);
   output_C(00000000);
   set_tris_A(0b00000000);
   port_B_pullups(true);        
   set_tris_B(0b11001111);
   set_tris_C(0b00000000);
 }
 
 
//-------------------------------------------Program--------------------------------------------------//
void radio_init()
{
  frequency=103.4   //frecventa radio romania actualitati
 
  frequencyB=4*(frequency*1000000+225000)/32768; 
  frequencyH=frequencyB>>8;
  frequencyL=frequencyB&0XFF;
 
  i2c_start();
  i2c_write(0xC0);
  i2c_write(frequencyH);
  i2c_write(frequencyL);
  i2c_write(0xB0);
  i2c_write(0x10);
  i2c_write(0x00);
  i2c_stop();
 
}
 
 
void radio_citire(unsigned char* byte1, unsigned char* byte2, unsigned char* byte3, unsigned char* byte4, unsigned char* byte5)
{
    i2c_start(); 
    i2c_write(0xC1);
    byte1 = i2c_read(1); 
    byte2 = i2c_read(1); 
    byte3 = i2c_read(1); 
    byte4 = i2c_read(1); 
    byte5 = i2c_read(0);  
    i2c_stop();
 
stereo = (byte3&0x80);
freq = ((((byte1&0x3F)<<8)+byte2)*32768/4-225000)/100000;
signal_level = (byte4 >> 4) * 100 / 16;
}
 
void radio(){
void radio_citire();
 
lcd_gotoxy(1,1);
printf(lcd_putc,"%2.0f %2.0f %2.0f        ",stereo,signal_level,freq);
lcd_gotoxy(1,1);
printf(lcd_putc,"%3.1wMHz  ",frequency);
}
 
void main()
{
pic_init();
display_init();
radio_init();
 
while(true){
radio();
   }
}
 
 
daca ma poate ajuta cineva, as fi recunoscator...dau si eu o bere... :reytre
Link to comment

 

//-------------------------------------------Program--------------------------------------------------//
void radio_init()
{
  frequency=103.4   //frecventa radio romania actualitati

 

Aici ai incercat sa modifici?

Link to comment
Guest nikc10

Aici ai incercat sa modifici?

Da. Am pus mai multe valori de frecvente pe care le stiu ca merg pe un radio. Nu merge nici una.

Link to comment

Asta nu inseamna ca frecventele nu sunt corect setate, ci ca ai o problema in circuit/program.Ca tot ai afisorul LCD, afiseaza diverse chestii in diverse puncte din program, sa vezi pana unde ajunge si unde se blocheaza.

Link to comment
Guest nikc10

Asta nu inseamna ca frecventele nu sunt corect setate, ci ca ai o problema in circuit/program.Ca tot ai afisorul LCD, afiseaza diverse chestii in diverse puncte din program, sa vezi pana unde ajunge si unde se blocheaza.

buna idee... sa afisez fiecare byte de scriere/citire in ordine...

Link to comment
Guest nikc10

Auzi fasaitul specific FM? Daca nu, radioul nu-i initializat corect. Comunicatia I2C functioneaza?

am verificat cu o casca pe o iesire...si se aude. Se pare ca partea de amplificare nu am facut-o bine...

 

i-ti multumesc pentru idee.

Asta nu inseamna ca frecventele nu sunt corect setate, ci ca ai o problema in circuit/program.

Ca tot ai afisorul LCD, afiseaza diverse chestii in diverse puncte din program, sa vezi pana unde ajunge si unde se blocheaza.

am verificat, programul este bun, ...  :hdgfhgdf doar ca nu am facut bine partea de amplificare...  :nas: am folosit un tda2822m, desi cu alta sursa audio (de la combina...) a mers, se pare ca, cu tea5767 nu vrea. Mai sap, cred ca trebuie sa pun c-uri pe intrari si rezistente de pe intrari catre masa...

 

Va multumesc pentru ajutor...

 

Stiti cum se poate programa volumul pentru cipul tea5767, trebuie sa folosesc un port adc al pic-ului?

Edited by nikc10
Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines