PIC to PC


Closed Thread
Results 1 to 4 of 4

Thread: PIC to PC

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thx alot taylor
    can anyone tell me what the different between SERIN n SERIN2.... I stil cant get the echo feedback by my PIC to the hyperterminal even i try many many times with different code Can anyone pls give me some example n some advice n some idea

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    SERIN\SEROUT were originally made to be compatible with the older BASIC Stamp 1 syntax.

    The BASIC Stamp 1 was very limited in what it could do, and these commands are also very
    limited. I.E. they do not support the list of modifiers shown in the PBP manual for SERIN2 or
    SEROUT2, DEBUG, HSERIN, HSEROUT, etc,,.

    To use T2400 you would need to insert include "MODEDEFS.BAS" in the beginning
    section of your code to use the serial MODE names.

    Or create a CONstant like T2400 CON 0, or SYMBOL T2400 = 0.

    SERIN2\SEROUT2 were made to be compatible with the higher-end BASIC Stamp2. How they
    work & the difference between these commands is shown in the PBP manual.

    The back section of the manual shows SERIN2\SEROUT2 MODE examples.

    This should work with SERIN2\SEROUT2;
    Code:
    DEFINE OSC 20
    
    Char VAR BYTE[20] ' 20 byte array for serial data
    CR CON 13         ' constant value of a carriage return
    
    Main:
        ' receive up to 20 characters, optionally terminated by CR
        SERIN2 PORTC.7,396,[STR Char\20\CR]
        
        ' echo back the received string of characters
        SEROUT2 PORTC.6,396,[STR Char,13,10]
    
        ' clear the string
        CLEAR
        
        GOTO Main
        
        END
    Since you're already using the hardware USART pins, you might want to consider using
    HSERIN & HSEROUT.

    This should work with HSERIN\HSEROUT;
    Code:
    DEFINE OSC 20
    DEFINE HSER_CLROERR 1
    
    Char VAR BYTE[20] ' 20 byte array for serial data
    CR CON 13         ' constant value of a carriage return
    
    Main:
        ' receive up to 20 characters, optionally terminated by CR
        HSERIN [STR Char\20\CR]
        
        ' echo back the received string of characters
        HSEROUT [STR Char,13,10]
        
        ' clear the string
        CLEAR
        
        GOTO Main
        
        END
    DEBUG and DEBUGIN are also options.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Replies: 24
    Last Post: - 2nd October 2017, 11:35
  2. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  3. Replies: 67
    Last Post: - 8th December 2009, 02:27
  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, 14:46
  5. Replies: 11
    Last Post: - 12th July 2008, 02:36

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