script22 Postat August 8, 2011 Partajează Postat August 8, 2011 am un tuner micut cu tea5767 http://www.rockbox.org/wiki/pub/Main/Da ... 5767-8.pdf se intampla chestii ciudate cu el in sensu ca nu se schimba mereu postu imediat dupa ce il alimentez merge sa schimb dupa nu mai vrea sau o ia dupa multe incercari la aldoilea cod cu bargraphu ledurile se schimnba in functie de text primesc si pe serial numele postu ramane acelasi ,poate dupa multe ikncercari o ia 'default template for script devboard atmega 16'_____________________________________________'setup$regfile = "m16def.dat"$crystal = 8000000$baud = 19200$lib "mcsbyte.lbx"'Config Portb.3 = Input ' ir receiverConfig Rc5 = Pinb.3Config Porta = Input ' pina.4.....7 push butons'Config Portc = Output ' led bargraphConfig Scl = Portc.0 'i2c sclConfig Sda = Portc.1 'i2c sdaConfig I2cdelay = 10 ' i2c delayPorta.4 = 1 ' enable pull up resistor buton 1Porta.5 = 1 ' enable pull up resistor buton 2Porta.6 = 1 ' enable pull up resistor buton 3Porta.6 = 1 ' enable pull up resistor buton 4'_____________________________________________'configDim Address As Byte , Command As Byte 'RC5 ir variableDim Pll As SingleDim Fset As WordDim Freq As Single ' set freqDim 1st As ByteDim 2nd As ByteDim 3rd As ByteDim 4st As ByteDim 5th As ByteConst Fref = 32.768 ' cristal freq radio moduleConst Fg = 250I2cinit'_____________________________________________'main programDoGetrc5(address , Command) 'read if we have remote ir command If Address = 10 Then Command = Command And &B01111111 End IfIf Command = 1 ThenFreq = 100.2Portc = &B100000Print "radio 21"End IfIf Command = 2 ThenFreq = 92.1Portc = &B010000Print "VIbe FM"End IfIf Command = 3 ThenFreq = 106.7Portc = &B001000Print "europa fm"End IfIf Command = 4 ThenFreq = 90.8Portc = &B000100Print "magic fm"End IfIf Command = 5 ThenFreq = 96.1Portc = &B000010Print "kiss fm"End If'If Pina.4 = 0 Then'Waitms 3'fi = fi + 0.1'End If'If Pina.5 = 0 Then'Waitms 3'fi = fi - 0.1'End IfPll = Freq * 1000Pll = Pll + FgPll = Pll * 4Pll = Pll / FrefFset = Int(pll)1st = High(fset)Reset 1st.7 'not muteReset 1st.6 'not search2nd = Low(fset)3rd = &B00010000If Command = 0 ThenSet 3rd.4 ' output is monoPrint "mono"End IfIf Command = 8 ThenReset 3rd.4 ' output is stereoPrint "stereo"End If4st = &B000100105th = &B00000000I2cstartI2cwbyte &HC0 'adresa icI2cwbyte 1stI2cwbyte 2ndI2cwbyte 3rdI2cwbyte 4stI2cwbyte 5thI2cstopLoopEnd am postat 2 modele de cod , am incercat mai multe aceleasi rezultate 'default template for script devboard atmega 16'_____________________________________________'setup$regfile = "m16def.dat"$crystal = 8000000$baud = 19200$lib "mcsbyte.lbx"'Config Portb.3 = Input ' ir receiverConfig Rc5 = Pinb.3Config Porta = Input ' led bargraphConfig Portc = Output ' pinc.4.....7 push butons'Config Scl = Portc.0 'i2c sclConfig Sda = Portc.1 'i2c sdaConfig I2cdelay = 10 ' i2c delayPorta.4 = 1 ' enable pull up resistor buton 1Porta.5 = 1 ' enable pull up resistor buton 2Porta.6 = 1 ' enable pull up resistor buton 3Porta.6 = 1 ' enable pull up resistor buton 4'_____________________________________________'configDim Address As Byte , Command As Byte 'RC5 ir variableDim Pll As SingleDim Fset As WordDim Freq As Single ' set freqDim 1st As ByteDim 2nd As ByteDim 3rd As ByteDim 4st As ByteDim 5th As ByteConst Fref = 32.768 ' cristal freq radio moduleConst Fg = 250I2cinit'_____________________________________________'main programDoDebounce Pina.4 , 0 , Ch1 , SubDebounce Pina.5 , 0 , Ch2 , SubDebounce Pina.6 , 0 , Up , SubDebounce Pina.7 , 0 , Down , SubCh1:Freq = 106.7Ch2:Freq = 100.2Up:Freq = Freq + 0.1Down:Freq = Freq - 0.1Pll = Freq * 1000Pll = Pll + FgPll = Pll * 4Pll = Pll / FrefFset = Int(pll)1st = High(fset)Reset 1st.7 'not muteReset 1st.6 'not search2nd = Low(fset)3rd = &B000100004st = &B000100105th = &B00000000I2cstartI2cwbyte &HC0I2cwbyte 1stI2cwbyte 2ndI2cwbyte 3rdI2cwbyte 4stI2cwbyte 5thI2cstopLoopEnd APPENDIX E: COMMUNICATION: WRITE MODE Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Data byte 1 mute Search mode PLL13 PLL12 PLL11 PLL10 PLL9 PLL8 Data byte 2 PLL7 PLL6 PLL5 PLL4 PLL3 PLL2 PLL1 PLL0 Data byte 3 Search up/down Search stop level HiLo side injection Mono/stereo Mute left Mute right SW port1 Data byte 4 SW port 2 Stand-by Band limits xtal Soft-mute HCC SNC Search indicator Data byte 5 PLL ref Deemph Not used Not used Not used Not used Not used Not used Data Description Mute 1: L-, R-audio muted 0: Audio not muted Search node 1: search mode 0: not in search mode PLL13..PLL0 Setting of the synthesizer programmable counter Search up/down 1: search up 0: search down Search stop level See table 4 (page 29) High/low side injection 1: high side LO injection 0: low side LO injection Mono/stereo 1: forced mono 0: stereo on Mute left 1: left audio muted and forced mono 0: not muted Right mute 1: Right audio muted and forced mono 0: not muted SW port 1 & SW port 2 1: Port high 0: Port low Stand-by 1: tuner in stand-by 0: not in stand-by Band limits (BL) 1: japan FM band US/Europe FM band Xtal 1: Fxtal is 32.768kHz 0: Fxtal is 13MHz Soft_mute 1: On 0: Off HCC 1: On 0: Off SNC 1: On 0: Off Search indicator 1: pin 14 is output for the ready flag 0: pin 14 is SW port 1 PLL ref 1: 6.5MHz reference for PLL enabled 0: 6.5MHz reference not enabled Deemph 1: deemphasis time constant is 75us 0: deemphasis time constant is 50us 4.2 PLL word calculation To tune the radio to a wanted frequency, the corresponding PLL word must first be calculated. This is a 14 bits word, which will be sent to the programmable divider. To do this a distinction will be made between high and low side injection. 4.2.1 High side injection tuning In high side injection mode the PLL word is calculated with the following formula: ( ) REFS RF if DEC F F F N 4 *( + ) ≡ with: NDEC = Decimal value of PLL word FRF = the wanted tuning frequency [Hz} Fif = the Intermediate Frequency [Hz] FREFS = the reference frequency [Hz} In the PC control software this is implemented in the following way: Application Note AN10133 Philips Semiconductors DRAFT 22 Low voltage FM stereo radio with TEA5767/68 PLL = NDEC = Decimal value of PLL word TunedFrequency is the wanted tuning frequency in MHz, Fif is the Intermediate Frequency of 225 kHz, REF[XTAL] is the reference frequency in kHz, which depends on the selection of the oscillator frequency as shown in the table below: XTAL PLL REF Reference frequency Crystal frequency 0 0 50000 Hz 13 MHz 0 1 50000 Hz 6.5 MHz 1 0 32768 Hz 32.768 kHz 1 1 32768 Hz 32.768 kHz Table 2: VCO reference frequency versus the crystal frequency Now that The PLL word has been calculated in decimal, it must be converted to Hex decimal before sending in to the tuning system. If the receiver has to be tuned to a FM frequency of 100MHz, the PLL word will be calculated as follow: Figure 12 gives an example of frequency tuning with high side injection. FVCO=200.45MHz High Side Injection Fwanted=100MHz FLO=100.225MH Fimage=100.5MHz :2 Figure 12: Example of PLL frequency calculation: high side injection + ≡ 1000 [ ] 4*( *1000 ) REF XTAL TunedFrequency F PLL ROUND if 1 52 Link spre comentariu
Liviu M Postat August 9, 2011 Partajează Postat August 9, 2011 In ambele coduri initializezi de doua ori porta.6 si niciodata porta.7. E typo? Porta.6 = 1 ' enable pull up resistor buton 3Porta.6 = 1 ' enable pull up resistor buton 4 'default template for script devboard atmega 16Porta.6 = 1 ' enable pull up resistor buton 3Porta.6 = 1 ' enable pull up resistor buton 4 Link spre comentariu
script22 Postat August 9, 2011 Autor Partajează Postat August 9, 2011 ms nu era asta problema sa rezolvat de dupa deva experimente cand trimit o comanda pinu 3 de la modul tre tinut la + si aici noul cod cu butoane si telecomanda 'default template for script devboard atmega 16'_____________________________________________'setup$regfile = "m16def.dat"$crystal = 8000000$baud = 19200$lib "mcsbyte.lbx"'Config Portb.3 = Input ' ir receiverConfig Rc5 = Pinb.3Config Porta =&B00001000 ' pina.4.....7 push butons'Config Portc = Output ' led bargraphConfig Scl = Portc.0 'i2c sclConfig Sda = Portc.1 'i2c sdaConfig I2cdelay = 10 ' i2c delayPorta.4 = 1 ' enable pull up resistor buton 1Porta.5 = 1 ' enable pull up resistor buton 2Porta.6 = 1 ' enable pull up resistor buton 3Porta.7 = 1 ' enable pull up resistor buton 4'_____________________________________________'configDim Address As Byte , Command As Byte 'RC5 ir variableDim Pll As SingleDim Fset As WordDim Freq As Single ' set freqDim 1st As ByteDim 2nd As ByteDim 3rd As ByteDim 4st As ByteDim 5th As ByteConst Fref = 32.768 ' cristal freq radio moduleConst Fg = 250I2cinitEnable Interrupts'_____________________________________________'main programDo Getrc5(address , Command) 'read if we have remote ir command If Address = 10 Then Command = Command And &B01111111 End IfIf Pina.4 = 0 ThenWaitms 3Command = 1End IfIf Pina.5 = 0 ThenWaitms 3Command = 2End IfIf Pina.6 = 0 ThenWaitms 3Command = 3End IfIf Pina.7 = 0 ThenWaitms 4Command = 4End IfSelect Case CommandCase 1Set Porta.3Freq = 100.2Print "Radio 21"Portc = &B10000000Case 2Set Porta.3Freq = 92.1Print "Vibe FM"Portc = &B01000000Case 3Set Porta.3Freq = 90.8Print "Magic FM"Portc = &B00100000Case 4Set Porta.3Freq = 106.7Print "Europa FM"Portc = &B00010000End SelectPll = Freq * 1000Pll = Pll + FgPll = Pll * 4Pll = Pll / FrefFset = Int(pll)1st = High(fset)Reset 1st.7 'not muteReset 1st.6 'not search2nd = Low(fset)3rd = &B00010000If Command = 0 ThenSet 3rd.4 ' output is monoPrint "mono"End IfIf Command = 8 ThenReset 3rd.4 ' output is stereoPrint "stereo"End If4st = &B000100105th = &B00000000I2cstartI2cwbyte &HC0 'adresa icI2cwbyte 1stI2cwbyte 2ndI2cwbyte 3rdI2cwbyte 4stI2cwbyte 5thI2cstopReset Porta.3LoopEnd Link spre comentariu
script22 Postat August 9, 2011 Autor Partajează Postat August 9, 2011 http-~~-//www.youtube.com/watch?v=m9BLD8lE46A Link spre comentariu
yo9hnf Postat Octombrie 3, 2011 Partajează Postat Octombrie 3, 2011 Script, ai mai rezolva ceva cu tunerul? Link spre comentariu
script22 Postat Octombrie 4, 2011 Autor Partajează Postat Octombrie 4, 2011 Script, ai mai rezolva ceva cu tunerul?cauta pe youtube tea5767 bascom avram 2 video Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum