PIC to PIC TX RX and PIC to PC COM RX ..a little help please


Closed Thread
Results 1 to 40 of 68

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    I think the modules you are using are the same as Bruce sells, the RWS/TWS ones?
    What are you using for an antenna and how long is it? Should be around 6.5 inches. Ground plane? Anything around that could be causing interference? A picture of the setup might help.

    Can you post the code that is sorta working? At this point it could be a number of things. We have to rule out hardware or software.

    Now try to tighten things up a bit.

    Code:
    TRAIN  VAR BYTE
    train =  $B3
    SYNK VAR BYTE
    SYNK = $7E
    
    SEROUT2 PORT??, BAUD?,[TRAIN, SYNK, DEC 23]
    Code:
    SYNK VAR BYTE
    SYNK = $7E
    MYVAR  VAR BYTE
    
    SERIN2  PORT??, BAUD?, [WAIT(SYNK), DEC MYVAR]
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default IT WORKS better than before :-)

    Dave :-)

    It's working like a charm :-)....I think, just getting an

    extra character on every second line :-)
    Range is awesome in the house, reaches all distant corners

    --will do range tests tomorrow and feedback to you.

    Here's the OLD code

    Which worked but wasn't too accurate

    TX CODE
    Code:
    TRAIN	VAR BYTE
    TRAIN=$55
    
    
    hSEROUT [TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,"9",dec 3,$d,$a]
    RX code
    Code:
    HSERIN [WAIT("9"),DEC NET]
    
     HSERout ["I Recived this number ",DEC NET,$d,$a] 'net var 
    
    value should show in hyperterminal
    Heres the NEW TX code
    USING HSER

    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous 
    
    receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 207 ' 2400 Baud @ 32MHz, 0.17%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    test:
    TRAIN  VAR BYTE
     train =  $B3
     SYNK VAR BYTE
     SYNK = $7E
    
    hserout [TRAIN,SYNK,DEC 23]
    goto test


    and the RX code:

    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous 
    
    receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 207 ' 2400 Baud @ 32MHz, 0.17%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    test:
    
    high led
    
    hserin [WAIT(SYNK), DEC net]
    
    
    toggle LED
    HSERout ["I Recived this number ",DEC NET,$d,$a] 'net var 
    
    value should show in hyperterminal
    
    goto test


    Here's my receiver output from MCS serial tool window
    Code:
    I Recived this number 2
    I Recived this number 23
    I Recived this number 2
    I Recived this number 23
    I Recived this number 2
    I Recived this number 23
    As you can see I'm receiving DEC 2 and 23.
    Where is the number 2 coming from ?
    Eerie ?

    Now all I need to do is akind of checksum for example, if

    the number 23 is received 3 times then it's a VALID TX.

    Any more optimizations or tweaks I should try ?

    Thanks a million

    Kind regards

    (From a very happy:-))
    Dennis

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


    Did you find this post helpful? Yes | No

    Default

    COOL!!!!

    Probably the easiest thing to do for this app would be a simple check.
    Code:
    hserin [WAIT(SYNK), DEC net]
    IF net = 23 THEN ...
    Or build a checksum... but try the above first, keep it simple.
    Last edited by mackrackit; - 6th December 2009 at 04:38.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Dennis, you should remove the DEC command from the HSEROUT see the code below.


    Code:
    A0 var BYTE
    
    A0=23
    'hserout [TRAIN,SYNK,DEC 23]
    hserout [TRAIN,SYNK, A0]
    Al.
    All progress began with an idea

  5. #5


    Did you find this post helpful? Yes | No

    Default Ok will try :-)

    Hi Al

    How are you?

    Thanks for the tip will definitely try it :-)

    Kind regards

    Dennis

Similar Threads

  1. Direct PIC to PC without MAX232
    By acjacques in forum Serial
    Replies: 14
    Last Post: - 23rd October 2014, 22:32
  2. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 01:52
  3. PIC or xbee times out after Tx 504 bytes
    By archendekta in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd November 2009, 09:45
  4. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  5. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 01:13

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