PICKit 2 USART


Closed Thread
Results 1 to 4 of 4

Thread: PICKit 2 USART

  1. #1
    Join Date
    Nov 2006
    Posts
    33

    Default PICKit 2 USART

    HI All

    I have look on the website (swordfish) where it use PICKIT 2 to Tx/Rx from PC directly using UART Tool.
    http://www.digital-diy.net/18F%20Exa...CKit2UART.aspx

    I had tried to do it as the website above with the following code. But FAILED!!
    On the UART Tool:-
    Echo is ON. When I type Hello, the screen only shown Hello Once and does not shown Hello Twice (send and echo). WHY??

    Code:
    DEFINE OSC 4
    
    ' Set baud rate
    DEFINE HSER_BAUD 9600
    
    DEFINE HSER_CLROERR 1
    
    datain VAR BYTE
    
    main:
    
         HSerin [datain]
         HSerout [datain]
         
        
    GoTo main

    Thanks

    Peter

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    You haven't enabled the serial port according to the PBP manual. All you've done is set the baud rate. That's it. HSERIN/HSEROUT are talking to a register that 'doesn't care' until you set the right DEFINEs.
    Have a look, add the code, see what happens.

  3. #3
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Hi

    I had added in the Define as below. I'm using PIC16F877A and 4 MHz.
    I enter "a" and click send. There are nothing echo back. "a" only show once when the echo button is checked.
    Any idea???


    Code:
    DEFINE OSC 4
    
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 6
    DEFINE HSER_CLROERR 1
    
    datain VAR BYTE
    
    main:
    
         HSerin [datain]
         HSerout [datain]
         
    GoTo main
    Any suggestion ???

    Thanks

    Peter
    Attached Files Attached Files
    Last edited by DragonBall_6; - 17th December 2008 at 15:14.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Did you try swapping the Rx/Tx pins on one end?
    And while you're at it, try 2400 baud, instead of 9600. Yes, 9600 should work...but 2400 should be a bit more reliable if there are other problems.

Similar Threads

  1. Unpacking a PICkit 2 Programmer/Debugger
    By duncan303 in forum General
    Replies: 20
    Last Post: - 14th May 2009, 22:24
  2. PICkit 2 and RBC interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 4th April 2009, 03:33
  3. PicKit 2 Questions
    By dmairspotter in forum General
    Replies: 3
    Last Post: - 11th November 2007, 22:10
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  5. Programming from MicroStudio to a PICKit 2
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th November 2006, 04:56

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