Serin Serout Help


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Your flowpin is on GPIO.3.

    SERIN2 GPIO.1\GPIO.3, 3313, [DEC X]

    Put the serial data on GPIO.3, and the flowpin on GPIO.1.
    flowpin needs to be able to output.

    And set GPIO.0 to OUTPUT for the LED.

    OUTPUT GPIO.0

    Don't forget to disable MCLR in the configuration.
    DT

  2. #2
    Join Date
    Nov 2010
    Posts
    7


    Did you find this post helpful? Yes | No

    Lightbulb Update

    I have been working on the code for a couple of days. I have made a small progression if i manually send a "1" to the SERIN it will assume a flash rate of 1. this is done by placing the datapin wire to ground. Hear is the current code i am working with. Any help would be great, Thanks!
    Code:
    Recive:
    Clear 
    define ocs 4
    INCLUDE "modedefs.bas"
    @_config_HS_osc &_WDT_OFF &_LVP_OFF &_CP_OFF &_BODEN_OFF
    ADCON1 = %00000111
    CMCON = %00000111
    TRISA = %11111111
    TRISD = %00000000
    X VAR BYTE
    SERIN2 PORTA.5\PORTA.1, 3313, [DEC X]
    LOOP1:     
       HIGH PORTD.2
       PAUSE X
       LOW PORTD.2
       PAUSE X
    GOTO LOOP1
    END  
    
    Send:
    Clear 
    define ocs 4
    INCLUDE "modedefs.bas"
    @_config_HS_osc &_WDT_OFF &_LVP_OFF &_CP_OFF &_BODEN_OFF
    ADCON1 = %00000111
    CMCON = %00000111
    TRISA = %00000000
    TRISD = %00000000
    PORTA = %00000000
    LED VAR PORTA.1
    X VAR BYTE
    X = 100
    LOOP1: 
       SEROUT2 PORTA.5/PORTA.1, 3313, [100]
       PAUSE 5000
    GOTO LOOP1
    END
    Thanks again!
    Last edited by ScaleRobotics; - 12th December 2010 at 21:02. Reason: added code tags

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Idle State

    Hi MangoKid,
    I am away from MY Computer and my books, but if I understand this last statement correctly,
    " this is done by placing the datapin wire to ground."
    I believe you are referring to the ports "Idle State" if so here is the little secret: If you are sending TRUE the port wants a pull up resistor and if you are sending INVERTED the port wants a pull Down resistor.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Not sure what you mean by datapin...
    But..
    On the receive side you are only checking the serial port once,
    Code:
    SERIN2 PORTA.5\PORTA.1, 3313, [DEC X]
    LOOP1:     
       HIGH PORTD.2
       PAUSE X
       LOW PORTD.2
       PAUSE X
    GOTO LOOP1
    Put the SERIN2 line inside of LOOP1.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Thats prolly my fault. Way back at the beginning I suggested to take it out of the loop. I was thinking it would be gotten before entering the loop.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Nov 2010
    Posts
    7


    Did you find this post helpful? Yes | No

    Thumbs up Update

    Thanks again i moved SERIN inside the loop but to no avail. I am assuming there is an issue with my baud rate. If i am sending should the sending and receiving baud rate be identical or should one be inverted?

    Thanks for the help

  7. #7
    Join Date
    Nov 2010
    Posts
    7


    Did you find this post helpful? Yes | No

    Lightbulb Serin Serout Solved!

    So after alot of headaches i have finally got SERIN SEROUT working . The first and biggest problem was the baud rate i was using the initial (3313) is only meant to communicate with a level converter. I am using (27889) which is 7bit with even parity. Here is the code i hope it helps anyone else who is stuck with the SERIN SEROUT.

    Send:

    clear
    DEFINE OCS 4
    ADCON1 = %00000111
    CMCON = %00000111
    TRISA = %11111111
    TRISD = %00000000
    X VAR BYTE
    X = 555

    LOOP1:
    SEROUT2 PORTA.5, 27889 , [244]
    PAUSE 500
    GOTO LOOP1
    END

    Recive:

    Clear
    define ocs 4
    ADCON1 = %00000111
    CMCON = %00000111
    TRISA = %11111111
    TRISD = %00000000
    X VAR BYTE

    LOOP1:
    LOW PORTD.3
    SERIN2 PORTA.5, 27889, [X]
    HIGH PORTD.3
    HIGH PORTD.2
    PAUSE (X * 10)
    LOW PORTD.2
    PAUSE (X * 10)

    GOTO LOOP1

    END

    Thanks Again to all those who helped solve this.

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