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

    Default PIC to PC

    Im using PIC16F877A with 20Mhz. I want connect my PIC via a MAX232 and using Hyperterminal to check the echo whatever i type in.... Can anyone pls give me some example...Im a newbie on PIC

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


    Did you find this post helpful? Yes | No

    Default

    From your other thread...
    i was using Hyperterminal and wanted to obtain echo from the PIC16F877A. The crystal im using is 20Mhz. BUt there was no echo at all can anyone pls help me

    DEFINE OSC 20
    DEFINE Ser2_BBITS 8
    TRISC = %10111111

    PinIn VAR PORTC.7
    PinOut VAR PORTC.6
    B1 VAR Byte
    SerIn2 PinIn, T2400,[B1]
    SerOut2 PinOut, T2400, [B1]

    END.

    can anyone pls help me. Im a beginner...
    If you are using SERIN2, then you need to use mode numbers as specified in the manual, or this webpage http://www.melabs.com/resources/ser2modes.htm.

    Constants like T2400 can only be used with SERIN (without the 2).
    DT

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

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