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

    Can you post your code please?

    Ioannis

  2. #2
    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.

  3. #3
    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

  4. #4
    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.

  5. #5
    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

  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

    Hi Ioannis,

    Unfortunately I'm stuck with these modules as the 'client' bought them.

    I have his base requirements working 100% but I let myself in for more work when I mentioned signal strength output.

    Trouble is the modules do not have any visual indication as to what they are doing. I'm working blind, other than turning leds on/off on my board at strategic points in the software.

    I get confirmation after each AT command that the slave is in test mode.

    It will not respond to anything else when in test mode other than "+++" guard characters for command mode, so I put in a time loop to turn test mode off later by software.

    The master sits and waits after confirming it is in test mode. Then nothing. Both should be transmitting at 1 second intervals with RSSI information in db fed on the serial port from the master. They loopback the RSSI.

    I do not have an interface to connect to my PC to test, besides that is no use anyway as the modules will be standalone. Testing on a PC just proves they work that way.

    I also considered another set of rf modules originally from another manufacturer. They had red and green status leds on board. Red when TX, green when RX. Both on for config mode. Much more useful.

    I chose the Ciseco modules because of power output and the support forum.

    At first on the forum I thought they were a bit defensive and odd. Now they insult my admittedly limited intelligence and are downright rude.
    I don't believe they read the replies carefully. I had to repeat what I had tested, even though the answer to what I had done was two posts up.

    I've spent tens of hours on this. I'm leaving them just doing the basic function the 'client' wanted. On/off red/green light.

    'Client' is a misnomer, I'm doing them for free.

    Rob

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


    Did you find this post helpful? Yes | No

    Default Re: Serin Serout possible wiring distance

    THIS IS FROM THEIR SETUP RSSI INFO PAGE

    The AT commands are in the brakets at the side. Compare to my code.


    In order to test the range between two devices, it is possible to put two XRF's into a special mode via either the AT commands or the XCM. Once in the special mode it will send a packet once a second from an XRF connected to your PC (master) to another 'remote' (slave) XRF. The slave XRF will measure the incoming RSSI level and send the packet straight back. The master XRF then measures the RSSI of this and displays both packets serially.

    The image below shows the continuous output you will see on your screen. We're interested in the first two values:
    aSSRSSIS-045 (the signal strength of 045) received at the slave and
    aMMRSSIM (046) received at the master (your PC).
    Name:  rssipix.png
Views: 1532
Size:  13.6 KB

    HOW TO SETUP
    During setup we advise turning off any other XRFs, so that only the two you are using to test range are turned on. If this is impossible then change the two devices to be tested to another PANID.
    First set up the slave (remote end).
    1. Configure on your PC using XCM or AT commands
    2. Change ATNT (node type) to 4 (ATNT4)
    3. Write to permanent memory (ATWR)
    4. Close the session (ATDN)
    Unplug the first XRF and plug in the second XRF
    Configure the master (PC end)
    1. Configure on your PC using XCM or AT commands
    2. Change ATNT (node type) to 3 (ATNT3)
    3. Write to permanent memory (ATWR)
    4. Close the session (ATDN)
    5. Leave the second XRF on your PC and in a serial monitor window as above
    Test Power up the first XRF with 2 to 3.6v, at a distance over 1 meter away. Two AA batteries are perfect for this, but make sure your voltage is not greater than 3.6v
    You will see the two RSSI levels being written to the screen once a second.
    MAXIMUM RANGE When the RSSI figures reach 88 to 92 you've reached the maximum distance you can achieve reliably. If you are planning to run at distances close to this then we advise conducting the test a few times during the day to make sure you are getting a reliable connection.

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