PIC16F877 to PC via max232 HELP!!


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi loredana,

    I'll suggest you to download MicroCode Studio there : http://www.rentron.com/mcstudio/mcstudio.exe

    One circuit example is already in the HELP TOPIC under ICD>Introduction>>Harware Setup. By the way i attach one example.

    With MicroCode studio you'll be able to send and receive to your PIC in the same windows task.

    I think from what I read so far its not possible to connect the the PIC to the MAX then to the port directly due to some inverting thing which I really dont understand.
    You can connect PIC directly to the PC without MAX232 if you're using SERIN/SEROUT and if you're using Inverted Mode. But if You're using the internal USART... you cannot set it by software. Hardware only, this is why you need an MAX232 or some simples inverter transistor circuit.

    I wonder if anyone could give me some working code to echo data sent from the pc back from the PIC so I can be sure to get started.
    The following will give you this @9600 baud.
    Code:
        ' Serial data echo test
        ' =====================
        '
        ' File name : Serial_echo_test.bas
        ' Company : Mister E 
        ' Programmer : Steve Monfette
        ' Date : 16/01/2005
        ' Device : PIC16F877
    
        ' PIC setting & Programming mode         
        ' -------------------------------
        '
    @ __config _HS_OSC & _WDT_ON & _PWRTE_ON & _BODEN_ON & _LVP_OFF                  
        ' HS(20Mhz) oscillator
        ' Enable watch dog timer
        ' Enable power up timer
        ' Enable brown out detect
        ' Disable low voltage programming
        DEFINE OSC 20 ' Use 20 MHZ oscillator
    
        ' Usart Settings
        ' --------------
        '
        ' refer to datasheet section 10 for the following settings
        '
        DEFINE HSER_RCSTA 90h  ' Enable Serial PORT
                               ' Enable continuous receive
                               '
        DEFINE HSER_TXSTA 24h  ' Enable transmit
                               ' High baud rate (BRGH=1)
                               '
        DEFINE HSER_SPBRG 129  ' set USART to 9600 baud (when BRGH=1)
        DEFINE HSER_CLROERR  1 ' Enable automatic overrun error
        
        ' Variable Definition
        ' -------------------
        SerData     var   byte
            
    Start:
        ' Program begining/Main Loop
        ' ==========================
        '
        HSERIN [serdata]
        hserout [serdata]
        goto start
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Direct PIC to PC without MAX232
    By acjacques in forum Serial
    Replies: 14
    Last Post: - 23rd October 2014, 21:32
  2. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  3. PIC16F877 sends/receives data to/from a PC
    By ovidiu in forum Serial
    Replies: 1
    Last Post: - 2nd December 2006, 14:09
  4. USB interface from PIC16F877 to PC
    By headshouter in forum USB
    Replies: 0
    Last Post: - 26th February 2006, 04:58
  5. connecting pic16F877A to pc via max232
    By zikha in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th January 2006, 15:31

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