Jump to content
ELFORUM - Forumul Electronistilor

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.

Share this post


Link to post
Share on other sites

Multumesc pentru link.Nu stiu cum a scapat gresela asta. Ca am folosit search, dar nu am gasit.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

 

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

 

Aici ai incercat sa modifici?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.