Serout -->>> serin


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    14

    Default Serout -->>> serin

    I HAVE SOME PROBLEM....
    I DONT KNOW WHY MY SEVEN SEGMENT COUNT 1,3,5,7,9

    MY CODE:

    SEROUT:

    I VAR BYTE
    TRISD = 0
    PORTD = 0

    LOOP1:
    GOSUB SEND
    I = I + 1
    PAUSE 200
    IF I > 9 THEN
    I = 0
    ENDIF
    GOTO LOOP1
    SEND :
    SEROUT2 PORTD.1,16468,["A",DEC I]
    RETURN
    END


    SERIN:

    INCLUDE "modedefs.bas"

    PATTERN VAR BYTE
    I VAR BYTE
    DIGIT VAR BYTE
    TRISC = 255
    PORTC = 0
    TRISB = 0
    PORTB = 0

    MAIN:
    DIGIT = I
    GOSUB CONVERT
    PORTB = PATTERN

    SERIN2 PORTC.3,16468,[WAIT("A"),DEC I]

    GOTO MAIN

    CONVERT:

    LOOKUP DIGIT, [$C0, $F9, $A4, $B0, $99, $92, $82, $F8, $80, $90], Pattern
    RETURN

    END

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


    Did you find this post helpful? Yes | No

    Default

    Hi larzazral,

    With SERIN2, the DEC modifier needs a non-numeric character to indicate the end of the number.
    Or, it needs to know how many digits to expect.

    As it is, the next non-numeric character is the "A" from the next packet, so that A (and it's data) are discarded, and it waits for the packet after that.
    Which makes it only receive every other packet.

    Either this on the transmit side ...
    Code:
    SEROUT2 PORTD.1,16468,["A",DEC I,";"]
    OR, this on the receive side ...
    Code:
    SERIN2 PORTC.3,16468,[WAIT("A"),DEC1 I]
    Should get you going.
    DT

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 16:46
  3. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  4. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

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