logo elektroda
logo elektroda
X
logo elektroda
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Rc5 kilka pytań Fala nośnia 36kHz?

xamrex 24 Mar 2011 13:51 1947 6
REKLAMA
MediaMarkt Black Week
  • #1 9316565
    xamrex
    Poziom 28  
    Witam,
    Zaciekawił mnie temat uniwersalnego wyłącznika telewizora.
    https://www.elektroda.pl/rtvforum/topic972435-30.html#5392043


    Wyczytałem, że standard RC5 pracuje na fali nośnej 36kHz
    Oraz, że większość telewizorów PHILIPSA, działa na komendę 100, aby wyłączyć TV.

    Teraz jeśli napiszę sobie program, który będzie wysyłał po naciśnięciu klawisza komendę 100, to czy wyłączę TV??

    Czy może trzeba jeszcze dobrać odpowiednią częstotliwość fali nośnej?
  • REKLAMA
    MediaMarkt Black Week
  • REKLAMA
    MediaMarkt Black Week
  • #3 9316672
    xamrex
    Poziom 28  
    Wiem, że ani rusz bez nośnej.
    Ale jeśli wygeneruje sobie nośną 36kHz, i będę wysyłał komendę 100, to czy większość TV Philipsa mi się wyłączy?

    Po co jest robiona taka tabela?


    Kod: C / C++
    Zaloguj się, aby zobaczyć kod
  • #4 9316732
    dondu
    Moderator na urlopie...
    xamrex napisał:
    Po co jest robiona taka tabela?

    Poświęć trochę czasu na przeczytanie komentarzy w pliku źródłowym który załączył autor. Pisze tam że:

    Cytat:
    // This function transmits one Code Element of a POWER code to the IR emitter,
    // given index to the codeElement in powerTab.

    // If offTime = 0 that signifies the last Code Element of the POWER code
    // and the delay_ten_us function will have no delay for offTime
    // (but we'll delay for 205 milliseconds in the main function)


    a opis dotyczy funkcji xmitCodeElement() która korzysta z tej tabeli.
  • #5 9316753
    xamrex
    Poziom 28  
    No nie bardzo to rozumiem, myślałem, że to generuje fale nośną trochę inną niż 36kHz.
  • #6 9316786
    dondu
    Moderator na urlopie...
    To czytaj także w programie to:
    Cytat:


    The following POWER code table consists of any number of POWER codes that will fit into the 2k flash ROM.
    Each POWER code consists of any number of codeElements, each of which consists of an onTime
    and an offTime (both onTime and offTime are expressed as the number of 10 microseconds -- for
    example, 4110 microseconds would be entered as 411).

    The onTime is a length of time that the
    IR emitter is being pulsed with the carrier frequency (usually about 40KHz).

    The offTime is a length of time that the IR emitter is not emitting any IR. The first codeElement of each
    POWER code is actually a fake one: the onTime contains the value to store in the compare
    register for Timer 0 (called OCR0A), and the offTime is ignored -- see more info on this in
    the next paragraph.

    The last codeElement of each POWER code in the table is signified by
    making its offTime = 0. To signify the last POWER code in the table, the last POWER code in
    the table must be followed by a codeElement with onTime = 0 (the offTime is ignored).

    As stated above, the carrier frequency for each POWER code is determined by the value for
    onTime in the POWER code's first codeElement. This value is derived from the following
    equation, given in the datasheet for the ATtiny2313:
    Output frequency = Fclk / (2 * Prescale * (1 + OCR1A) ) = 8,000,000 / (2 * (1 + OCR0A) )
    So, given a desired carrier frequency, with the ATtiny2313 Fclk at 8.0Mhz, we determine OCR0A
    by the following equation:
    OCR0A = ( ( (8,000,000.0 / carrierFrequency) / 2.0 ) - 1.0)
    Where the carrierFrequency is stated in Hz (with at least one decimal place at the end).
    Since all of these values are constants, we will let the C compiler calculate this value in
    powerTab (using floating point by using a decimal point with all of the numbers).


    There is a delay of 205 milliseconds after each POWER code is transmitted (whenever offTime = 0).
    This delay is necessary so that a TV receiving the wrong POWER code will have time to reset itself
    before receiving the next POWER code (which might be the correct one for it).
  • #7 9316991
    mirekk36
    Poziom 42  
    xamrex napisał:
    No nie bardzo to rozumiem, myślałem, że to generuje fale nośną trochę inną niż 36kHz.


    Panie kolego ;) z tego co wiem to posiadasz zdaje się jakąś książkę ;) .... a w niej masz bardzo dokładnie opisane jak generować sobie nośną - dowolną nośną bo pokazane jest jak sobie to obliczać. Więcej - masz pokazane na przykładach żywego kodu źródłowego - typu pilot podczerwieni. Więc bez najmniejszych problemów możesz zrobić sobie dowolny pilot. A przykład pilota RC5 masz właśnie dokładnie opisany i cały kod z objaśnieniami ;) ....

    Reasumując, jak wiesz ramka RC5 składa się z Command i Address.

    Większość telewizorów posiada Address=0, zatem jeśli taki twój pilot będzie wysyłał kod klawisza do wyłączania Command=XX to będzie to działać z każdym TV firmy Philips.

    Na prawdę polecam przestudiować ten rozdział - gdzie masz opisane wszystko krok po kroku i to w języku polskim ;) .... a jak coś będzie nie jasne - to zawsze można przecież dopytać ;)

    Dodano po 1 [minuty]:

    A jak będziesz chciał później zrobić urządzonko, które wyłącza różne TV to warto zapoznać się z sygnałami różnych pilotów z:

    www.lirc.org/remotes

    i na tej podstawie stworzyć sobie właśnie taką tabelę kodów różnych pilotów żeby nadawało ciurkiem nie tylko RC5 ale i np Panasonic'a , Sony, JVC i inne ;)
REKLAMA