transmitter receiver help


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Default transmitter receiver help

    Hello
    I am a new user in picbasic and would want help
    I found this code for 16F84 but communication transmitter receiver is not good

    Thanks

    Transmitter
    Code:
    DEFINE OSC 4
    DEFINE BUTTON_PAUSE 50
    
    TRISA=%11110
    TRISB=%11110000           
    PORTA=0
    PORTB=0
    
    
    VERICI VAR Byte	
    VERICI=0
    Index VAR Byte
    X VAR Byte
    b1 var Byte
    b2 var Byte
    b3 var Byte
    b4 var Byte
    PAUSE 500
    
    
    START:
    Button PORTA.1,0,255,0,b1,1,ch1
    Button PORTA.2,0,255,0,b2,1,ch2
    Button PORTA.3,0,255,0,b3,1,ch3
    Button PORTA.4,0,255,0,b4,1,ch4
    GoTo START
    
    
    ch1:
    VERICI=10
    GoTo GONDER
    
    ch2:
    VERICI=20
    GoTo GONDER
    
    ch3:
    VERICI=30
    GoTo GONDER
    
    ch4:
    VERICI=40
    GoTo GONDER
    
    
    GONDER:
    SerOut PORTA.0,396,[REP$AA\5,REP$00\5,REP$FF\5]
    SEROUT2 PORTA.0,396,["I","S","K","O",VERICI] 
    GoTo START
    receiver

    Code:
    DEFINE OSC 4             
    TRISA=0011              
    TRISB=%11110000       
    PORTA=0
    PORTB=0
    
    dekths VAR BYTE
    Index VAR BYTE
    aa1 var word
    x VAR BYTE
    aa2 var word
    aa3 var word
    dekths=0
    aa1=300
    aa2=300
    aa3=500
    
    PAUSE 500
    
    START:
    SERIN2 PORTA.0,396,[WAIT("ISKO"),dekths]  
     
    
    if PORTA.1=1 then poa1        
    if PORTA.1=0 then poao         
        
    poao:                         
        IF dekths=10 THEN          
    	high PORTB.0
    	PAUSE aa2
        low PORTB.0
        PAUSE aa3
        ENDIF
    	
    	IF dekths=20 THEN         
    	high PORTB.1
    	PAUSE aa2
        low PORTB.1
        PAUSE aa3
        ENDIF
    
    	IF dekths=30 THEN          
    	high PORTB.2
    	PAUSE aa2
        low PORTB.2
        PAUSE aa3
        ENDIF
    
    	IF dekths=40 THEN        
    	high PORTB.3
    	PAUSE aa2
        low PORTB.3
        PAUSE aa3
        ENDIF
    
    GOTO START
    
    
    poa1:                           
        IF dekths=10 THEN         
    	TOGGLE PORTB.0
    	PAUSE aa1
        ENDIF
    	
    	IF dekths=20 THEN          
    	TOGGLE PORTB.1
    	PAUSE aa1
        ENDIF
    
    	IF dekths=30 THEN         
    	TOGGLE PORTB.2
    	PAUSE aa1
        ENDIF
    
    	IF dekths=40 THEN          
    	TOGGLE PORTB.3
    	PAUSE aa1
        ENDIF
    
    GOTO START
    END

  2. #2
    sakis st's Avatar
    sakis st Guest


    Did you find this post helpful? Yes | No

    Default

    Try it

    SerOut PORTA.0,396,[REP$AA\5,REP$00\5,REP$FF\5]
    pause 200 <----------------------------------------
    SEROUT2 PORTA.0,396,["I","S","K","O",VERICI]
    pause 200 <----------------------------------------

  3. #3
    Join Date
    Jun 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    It is better but Lost a bytes

    thanks

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    See http://davehouston.org/RFTipsTricks.htm for an explanation of why using $55 or $AA for synchronization is not the best way to do this.

  5. #5
    Join Date
    Jun 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Hi dhouston
    Please give me an example in picbasic

  6. #6
    Pedro Pinto's Avatar
    Pedro Pinto Guest


    Did you find this post helpful? Yes | No

    Default

    Hi dhouston
    Please give me an example in picbasic


    Me too.
    Thank You

    Regards
    Pedro

  7. #7
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pedro Pinto View Post
    Please give me an example in picbasic
    Follow the links on the referenced webpage.
    Me too.
    You,too.

    Note: The SerOut2/SerIn2 example has not been tested - I'm too busy with a project of my own right now.

  8. #8
    Join Date
    Jun 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Note: The SerOut2/SerIn2 example has not been tested - I'm too busy with a project of my own right now
    any help ;

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. 433 Mhz Data Receiver
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 29th November 2010, 02:26
  3. Single PIC As Both, Wireless Transmitter and Receiver
    By charlieb83 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2007, 04:35
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. receiver can not receive proper signal
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st March 2006, 02:51

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