Serin Serout possible wiring distance


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    I'd prefer to do this in hardware serial port because it is much faster. Or at least the Debug and Debugin.

    Some serial devices do respond very fast and had a case where Serin/Serout was unable to follow.

    Ioannis

  2. #2
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    Not having any success getting the modules into test mode using the AT commands as per the code.

    I'm saying this because the routine stops waiting for a signal strength report which isn't there. This means the routine to put it into test mode isn't working.

    Anyone any suggestions ?

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    Can you post your code please?

    Ioannis

  4. #4
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    I have built a circuit, where PIC16F870 and 16F628A talk to each other via serial port, 9600 bps. Using Cat. 5E ethernet cable, it works fine at 20 meter distance. It may work on longer one too, just I had no need, so haven't tested.

  5. #5
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    Thanks for info CuriousOne.


    Ioannis,

    I'll post both codes. At the moment I'm also on the Ciseco forum trying to get to bottom of this. Seems to be sending packets but I'm not getting them. It stops in control code at "Signal Strength" on LCD so it appears that there is no info received in order to carry on in code.

    CONTROL Code (Master)

    Code:
    ;#######################################################
    ;                                                      #
    ;         868.3 MHz RF Link - Control Unit             #
    ;                                                      #
    ;            Rob Lane   22-4-2013                      #
    ;                                                      #
    ;#######################################################
    '
    '
    ;*****************************************************************************
    ;
    ; Target Controller -      PIC16F628A 
    ;                          __________  
    ;    RF MODULE PIN 2--RA2 |1       18| RA1--- R SELECT
    ;    RF MODULE PIN 3--RA3 |2       17| RA0--- E BIT
    ;                   --RA4 |3       16| OSC1--
    ;     +5V--via 4.7k-!MCLR |4       15| OSC2--
    ;           Ground----Vss |5       14| VDD--- +5 V
    ;    sig strength on--RB0 |6       13| RB7--- data 0
    ;           SWITCH  --RB1 |7       12| RB6--- data 9
    ;         GREEN LED --RB2 |8       11| RB5--- data 8
    ;         RED LED   --RB3 |9       10| RB4--- data 7
    ;                          ----------
    ; 
    ; ****************************************************************************
    ; * Configuration fuse information:
    ; ****************************************************************************
    @ __config _HS_OSC & _WDT_OFF & _MCLRE_OFF & _BODEN_OFF & _LVP_OFF & _CP_OFF
    '
    INCLUDE "modedefs.bas" 
    DEFINE OSC 10
    
    TRISA=%00000000
    TRISB=%11110000
    CMCON=7                  ; comparators off
            
    redled VAR PortB.3
    greenled VAR PortB.2
    jump  VAR PortB.0        ; signal strength switch
    switch VAR PortB.1
    
    redstop VAR BYTE
    greengo VAR BYTE
    rfon var byte
    flip VAR BYTE
    
    sigfield var word
    sigcontrol var word
    
    
    DEFINE DEBUG_REG PORTA   ; Set Debug pin port
    DEFINE DEBUG_BIT 3       ; Set Debug pin bit
    DEFINE DEBUG_BAUD 9600   ; Set Debug baud rate
    DEFINE DEBUG_MODE 0      ; Set Debug mode: 0 = true, 1 = inverted
    
    DEFINE DEBUGIN_REG PORTA ; Set Debugin pin port
    DEFINE DEBUGIN_BIT 2     ; Set Debugin pin bit
    DEFINE DEBUGIN_MODE 0    ; Set Debugin mode: 0 = true, 1 = inverted
    
    
            '       LCD Display
            '       -----------
            '       Adjust these to suit your chosen LCD pinout
            '
    Define LCD_DREG PORTB          ' Port for LCD Data
    Define LCD_DBIT 4              ' Use upper 4 bits of Port
    Define LCD_RSREG PORTA         ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 1             ' Port Pin for RS bit
    Define LCD_EREG PORTA          ' Port for Enable (E) bit
    Define LCD_EBIT 0              ' Port Pin for E bit
    Define LCB_BITS 4              ' Using 4-bit bus
    Define LCD_LINES 2             ' Using 2 line Display
    Define LCD_COMMANDUS 1200      ' Command Delay (uS)
    
    
           PAUSE 500
           LCDOut $FE,1                   ' Clear LCD
           PAUSE 10
           LCDOUT  $FE,$80,"   Rob Lane  "
           LCDOUT  $FE,$C0,"       2013    "
           PAUSE 2000      
    
    redstop = 1
    greengo = 2
    rfon = 3
    
          LCDOUT  $FE,1
          pause 10
          LCDOUT  $FE,$80, "Waiting"
          
          IF SWITCH = 1 THEN FLIP = 0     ; check staus of switch at power up
          IF switch = 0 then flip = 1     ; counter setup flipflop for single command send
    
          
    main:
    if jump = 0 then rssion
    
    IF switch = 1 AND flip = 0 THEN GOSUB red
        PAUSE 50
    IF switch = 0 AND flip = 1 THEN GOSUB green
    
    GOTO main
    
    red:
        PAUSE 1
        DEBUG "BOB",redstop
        if jump = 0 then rssion                            ; check if signal strength display needed
        DEBUGIN  500,red,[WAIT("ACK")]
        LOW greenled                                       ; turn off green led
        HIGH redled                                        ; turn on red led
        LCDOUT  $FE,1                                      ; clear lcd
        Pause 10
        LCDOUT  $FE,$80," Light is RED "
        flip = 1                                  ; flip flop counter to ensure send only once
    
        RETURN  
        
    green:
        PAUSE 1    
        DEBUG "BOB",greengo
        if jump = 0 then rssion  
        DEBUGIN  500,green,[WAIT("ACK")]
        LOW redled
        HIGH greenled
        LCDOUT  $FE,1
        PAUSE 10
        LCDOUT  $FE,$C0," Light is GREEN "
        flip = 0
    
        RETURN 
        
    rssion:
    
        LCDOUT  $FE,1
        Pause 10
        LCDOUT  $FE,$80," Test Mode "
        pause 1500
        
    ;   ############### TEST MODE ON #####################
    
    ison:
        debug "BOB",rfon
        if jump = 1 then rssioff
        debugin 1000,ison,[WAIT("ACK")]
        
        PAUSE 1100                           ; wait 1 second
        debug "+++"
        debugin 1500,ison,[WAIT("OK")]
        PAUSE 1100                           ; wait 1 second
        LCDOUT  $FE,$80, "Pass +++"
        pause 1500                                                
        debug "ATNT3",13,10                                                    
        debugin 1500,ison,[WAIT("OK")]
        LCDOUT  $FE,$80, "Pass ATNT3"
        pause 1500                                                
        DEBUG "ATDN",13,10
        debugin 1500,main,[WAIT("OK")]
        LCDOUT  $FE,$80, "Pass ATDN"
        pause 1500
        LCDOUT  $FE,$80, "Signal Strength"
        Pause 10
        
    sigstrength:
    
        if jump = 1 then rssioff     ; check input to reset to serial                                             
        debugin  1000,sigstrength,[WAIT("aSSRSSIS-",sigfield)]    ; get slave signal strength value                                        
        debugin  1000,sigstrength,[WAIT("aMMRSSIM-",sigcontrol)]  ; get control signal strength value 
        
        LCDOUT  $FE,$80," Light Unit ",sigfield                                       
        LCDOUT  $FE,$C0," Control Unit ",sigcontrol                                         
        goto sigstrength
             
    rssioff:
    
        LCDOUT  $FE,1
        Pause 10
        
        PAUSE 1100                           ; wait 1 second
        debug "+++"
        debugin 1500,rssioff,[WAIT("OK")]
        PAUSE 1100                           ; wait 1 second
        debug "ATNT0",13,10
        debugin  1500,rssioff,[WAIT("OK")]
        debug  "ATDN",13,10
        debugin 1500,main,[WAIT("OK")]
        LCDOUT  $FE,1
        pause 10
        goto main 
        
        
    END

    FIELD Code (Slave)

    Code:
    ;#######################################################
    ;                                                      #
    ;          868.3 MHz RF Link - Field Unit              #
    ;                                                      #
    ;              Rob Lane   22-4-2013                    #
    ;                                                      #
    ;#######################################################
    '
    '
    ;*****************************************************************************
    ;
    ; Target Controller -      PIC16F628A 
    ;                          __________  
    ;    RF MODULE PIN 2--RA2 |1       18| RA1--------- RELAY
    ;    RF MODULE PIN 3--RA3 |2       17| RA0---------
    ;                    -RA4 |3       16| OSC1--------
    ;     +5V-----------!MCLR |4       15| OSC2--------
    ;     Ground----------Vss |5       14| VDD---------+5 V
    ;          -----------RB0 |6       13| RB7---------
    ;          -----------RB1 |7       12| RB6---------
    ;                  ---RB2 |8       11| RB5---------
    ;                   --RB3 |9       10| RB4---------
    ;                          ----------
    ; 
    ; ****************************************************************************
    ; * Configuration fuse information:
    ; ****************************************************************************
    @ __config _HS_OSC & _WDT_OFF & _MCLRE_OFF & _BODEN_OFF & _LVP_OFF & _CP_OFF
    '
    INCLUDE "modedefs.bas" 
    DEFINE OSC 10
    
    TRISA=%00000100
    CMCON=7
    
    relay   VAR PortA.1
    
    signal VAR BYTE
    
    DEFINE DEBUG_REG PORTA   ; Set Debug pin port
    DEFINE DEBUG_BIT 3       ; Set Debug pin bit
    DEFINE DEBUG_BAUD 9600   ; Set Debug baud rate
    DEFINE DEBUG_MODE 0      ; Set Debug mode: 0 = true, 1 = inverted
    
    DEFINE DEBUGIN_REG PORTA ; Set Debugin pin port
    DEFINE DEBUGIN_BIT 2     ; Set Debugin pin bit
    DEFINE DEBUGIN_MODE 0    ; Set Debugin mode: 0 = true, 1 = inverted
    
    LOW relay
    
    
    
    ' Program
    main:
        
        debugin [WAIT("BOB"),signal]
            
        IF signal = 1 THEN 
        GOSUB redstop 
        ENDIF
    
        IF signal = 2 THEN
        GOSUB greengo
        ENDIF
        
        IF signal = 3 THEN
        GOSUB rssion
        ENDIF
    
    GOTO main
        
    
    redstop:
        HIGH relay
        PAUSE 1000 
        debug "ACK" 
        RETURN
    
    greengo:
        LOW relay
        PAUSE 1000
        debug "ACK" 
        RETURN 
        
        
    rssion:
    
        debug "ACK"
        pause 10
        debug "ACK"
        pause 10
        debug "ACK"
        
       
        PAUSE 1100
        debug "+++"
        debugin 1500,rssion,[WAIT("OK")] 
        PAUSE 1100
        high relay                          ;relay has led for ON
        pause 500
        debug "ATNT4",13,10
        debugin  1500,rssion,[WAIT("OK")]
        low relay
        pause 500
        debug  "ATDN",13,10
        debugin  1500,rssion,[WAIT("OK")]
        high relay
        
        
        pause 15000         ; waiting time in test mode before return to normal
        goto rssioff
        
        
    rssioff:
        PAUSE 1100                           ; wait 1 second
        debug "+++"
        debugin 1500,rssioff,[WAIT("OK")]
        PAUSE 1100                           ; wait 1 second
        debug  "ATNT0",13,10
        debugin  1500,rssioff,[WAIT("OK")]
        debug "ATDN",13,10
        debugin 1500,rssioff,[WAIT("OK")]
        goto main
                
      
    END

  6. #6
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    Ioannis and all,

    Please forget these modules. The rudeness I received on the Ciseco forum from the manufacturers means I'm abandoning them.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    Without a Datasheet is difficult to make something good.

    There are many modules that can do the job. Do you have a target price and freq range?

    Ioannis

Similar Threads

  1. Using SEROUT and SERIN
    By acinorth in forum Test Area
    Replies: 1
    Last Post: - 20th July 2011, 11:33
  2. Serout -->>> serin
    By larzazral in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th February 2010, 03:46
  3. SERIN and SEROUT
    By CumQuaT in forum mel PIC BASIC
    Replies: 10
    Last Post: - 3rd September 2009, 00:17
  4. serin,serout
    By andrewwaack in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th July 2006, 19:21
  5. serin/serout
    By simonr in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th September 2003, 18:45

Members who have read this thread : 0

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