USART with INTERRUPTS


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy USART Problems

    Thanks SkiMask,

    I have used and tested SEROUT2 many times without a hitch, it is sending test values just as I send them.
    As far as reading the USART manual, I have been reading it for the last 2 days.
    I am getting square eyes but seem to have missed something.

    You saw how I used SEROUT2 in my code (is it wrong?)

    Maybe I should just use HERIN instead

    Regards

    Chris

  2. #2
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy USART Problems

    Yes, just a loopback

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by crhomberg View Post
    Yes, just a loopback
    See post 6. Are you using a max232 or the resistors like in the manual?

    AND WHICH VERSION OF PBP ARE YOU USING?

  4. #4
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default USART Problems

    I tried the tester as below (cut & paste except the range) but just a a list of ascii garbage. I am monitoring using the microcode studeo serial communicator and have tried receiving at various speeds.
    The output is via a 1K resistor.

    Regards

    Chris

    ´*********************************

    @ device hs_OSC, wdt_on, pwrt_on, protect_off
    define osc 20

    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 64 ' 2400 Baud @ 4MHz, 0.17%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically

    Pause 500

    Start:
    FOR SPBRG=15 to 100
    HSEROUT ["SPBRG=",#SPBRG]
    PAUSE 50
    NEXT
    stop 'put this in to do it only once
    GOTO Start

  5. #5
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default USART Problems

    By the way,

    I am using PBP version 2.46

    Regards

    Chris

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you are using HSERIN/HSEROUT, you can't simply use a resistor. The data is inverted compared to what it needs to be in order to communicate with any normal serial device (such as a PC).

    A MAX232 (or equivalent), not only changes the voltage swings and levels, it inverts the signals as well.
    Charles Linquist

  7. #7
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking USART Problems

    Thanks to both of you,

    I have finally had success but I have to admit that the problem was me all the time and I only added the MAX232 at the end but still had problems.
    All that was needed was a decoupling cap on the Max232.

    I have to eat humble pie today!

    Thanks all,

    You have kept my sanity

    Regards

    Chris

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  5. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56

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