Pic16f84 and RC5 kode


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Red face Pic16f84 and RC5 kode

    Hi,
    I nead making infra red switcher with PIC,
    if ani having sample please help me.

    thank you!

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by terminator View Post
    Hi,
    I nead making infra red switcher with PIC,
    if ani having sample please help me.

    thank you!
    Could you post any FEWER details about your project?

  3. #3
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89

    Default

    DEFINE OSC 8
    INCLUDE "MODEDEFS.BAS"
    A1 VAR WORD
    B0 VAR BYTE
    TRISA = %00000011
    TRISB = %00000000
    LOW PORTB
    PAUSE 500
    Start: IF PORTA.0 = 1 THEN START
    PAUSEUS 100
    IF PORTA.0 = 1 THEN START
    PAUSEUS 1350
    A1.0[13] = PORTA.0
    FOR B0 = 12 to 0 STEP - 1
    A1.0[B0] = PORTA.0
    PAUSEUS 1700
    NEXT B0
    IF A1.LowByte = $FF THEN START
    A1 = ~A1 & $003F
    IF PORTA.1 = 1 THEN
    GOTO DO
    ELSE
    GOTO PO
    ENDIF

    DO: IF A1 = 1 THEN RL1
    IF A1 = 2 THEN RL2
    IF A1 = 3 THEN RL3
    IF A1 = 4 THEN RL4
    IF A1 = 5 THEN RL5
    IF A1 = 6 THEN RL6
    IF A1 = 7 THEN RL7
    IF A1 = 8 THEN RL8
    IF A1 = 9 THEN RL9
    IF A1 = 0 THEN RL10
    IF A1 = 16 THEN RLH
    IF A1 = 17 THEN RLL

    PO: IF A1 = 1 THEN RLP1
    IF A1 = 2 THEN RLP2
    IF A1 = 3 THEN RLP3
    IF A1 = 4 THEN RLP4
    IF A1 = 5 THEN RLP5
    IF A1 = 6 THEN RLP6
    IF A1 = 7 THEN RLP7
    IF A1 = 8 THEN RLP8
    IF A1 = 9 THEN RLP9
    IF A1 = 0 THEN RLP10
    IF A1 = 16 THEN RLPH
    PAUSE 250
    GOTO START
    RL1: TOGGLE PORTB.0
    PAUSE 500
    GOTO START
    RL2: TOGGLE PORTB.1
    PAUSE 500
    GOTO START
    RL3: TOGGLE PORTB.2
    PAUSE 500
    GOTO START
    RL4: TOGGLE PORTB.3
    PAUSE 500
    GOTO START
    RL5: TOGGLE PORTB.4
    PAUSE 500
    GOTO START
    RL6: TOGGLE PORTB.5
    PAUSE 500
    GOTO START
    RL7: TOGGLE PORTB.6
    PAUSE 500
    GOTO START
    RL8: TOGGLE PORTB.7
    PAUSE 500
    GOTO START
    RL9: TOGGLE PORTA.2
    PAUSE 500
    GOTO START
    RL10: TOGGLE PORTA.3
    PAUSE 500
    GOTO START
    RLH: HIGH PORTB.0
    HIGH PORTB.1
    HIGH PORTB.2
    HIGH PORTB.3
    HIGH PORTB.4
    HIGH PORTB.5
    HIGH PORTB.6
    HIGH PORTB.7
    HIGH PORTA.2
    HIGH PORTA.3
    PAUSE 500
    GOTO START
    RLL:
    LOW PORTB.0
    LOW PORTB.1
    LOW PORTB.2
    LOW PORTB.3
    LOW PORTB.4
    LOW PORTB.5
    LOW PORTB.6
    LOW PORTB.7
    LOW PORTA.2
    LOW PORTA.3
    PAUSE 500
    GOTO START
    RLP1: HIGH PORTB.0
    PAUSE 500
    LOW PORTB.0
    GOTO START

    RLP2: HIGH PORTB.1
    PAUSE 500
    LOW PORTB.1
    GOTO START
    RLP3: HIGH PORTB.2
    PAUSE 500
    LOW PORTB.2
    GOTO START
    RLP4: HIGH PORTB.3
    PAUSE 500
    LOW PORTB.3
    GOTO START
    RLP5: HIGH PORTB.4
    PAUSE 500
    LOW PORTB.4
    GOTO START
    RLP6: HIGH PORTB.5
    PAUSE 500
    LOW PORTB.5
    GOTO START
    RLP7: HIGH PORTB.6
    PAUSE 500
    LOW PORTB.6
    GOTO START
    RLP8: HIGH PORTB.7
    PAUSE 500
    LOW PORTB.7
    GOTO START
    RLP9: HIGH PORTA.2
    PAUSE 500
    LOW PORTA.2
    GOTO START
    RLP10: HIGH PORTA.3
    PAUSE 500
    LOW PORTA.3
    GOTO START
    RLPH: HIGH PORTB.0
    HIGH PORTB.1
    HIGH PORTB.2
    HIGH PORTB.3
    HIGH PORTB.4
    HIGH PORTB.5
    HIGH PORTB.6
    HIGH PORTB.7
    HIGH PORTA.2
    HIGH PORTA.3
    PAUSE 500
    LOW PORTB.0
    LOW PORTB.1
    LOW PORTB.2
    LOW PORTB.3
    LOW PORTB.4
    LOW PORTB.5
    LOW PORTB.6
    LOW PORTB.7
    LOW PORTA.2
    LOW PORTA.3
    GOTO START
    END

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    DEFINE OSC 8
    INCLUDE "MODEDEFS.BAS"
    a1 var word : b0 var byte : trisa=3 : trisb=0 : low portb : pause 500
    Start: IF PORTA.0 = 1 THEN START
    PAUSEUS 100 : IF PORTA.0 = 1 THEN START
    PAUSEUS 1350 : A1.0[13] = PORTA.0
    for b0 = 12 to 0 step -1 : a1.0[b0]=porta.0 : pauseus 1700 : next b0
    if a1.lowbyte = $FF THEN START
    A1 = ~A1 & $003F
    IF PORTA.1 = 1 THEN
    if a1 > 0 and a1 < 9 then
    toggle portb.0[a1-8] : pause 500 : goto start
    else
    if a1=9 then
    toggle porta.2 : pause 500 : goto start
    else
    if a1=10 then
    toggle porta.3 : pause 500 : goto start
    else
    if a1=11 then
    portb=$ff : porta.2=1 : porta.3=1 : pause 500 : goto start
    else
    if a1=12 then
    portb=0 : porta.2=0 : porta.3=0 : pause 500 : goto start
    endif
    endif
    endif
    endif
    endif
    ELSE
    if a1>0 and a1<9 then
    high portb.0[a1-8] : pause 500 : low portb.0[a1-8]:goto start
    else
    if a1=9 then
    high porta.2 : pause 500 : low porta.2 : goto start
    else
    if a1=10 then
    high porta.3 : pause 500 : low porta.3 : goto start
    else
    if a1=11 then
    portb=$ff : porta.2=1 : porta.3=1 : pause 500 : portb.=0 : porta.2=0 : porta.3=0 : goto start
    endif
    endif
    endif
    endif
    ENDIF
    PAUSE 250 : GOTO START
    END

  5. #5
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89

    Default

    Hi skimask,

    Thanks to redused code.

  6. #6
    Join Date
    Jun 2007
    Posts
    2

    Default

    Thank you

    I Maaked detektor with ic 555 like generator ic signals and any Pic in reciver module (16f84).
    If stop signal then rele in NC kontakt have horn.
    this program is first tray, workin bat having too many problems.

    'on of if any tast. in the tv remote kontrol push down.
    'TSOP 1736 data in pin A.2


    rele var PortB.6
    id var byte

    TRISA.2=1
    id=0

    Pocetak:

    low led
    pulsin PortA.2,0,id
    if id >100 then ukljuci
    goto pocetak

    ukljuci:

    high rele
    goto pocetak

    end

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts