HSER Problems


Closed Thread
Results 1 to 10 of 10

Thread: HSER Problems

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Posts
    14

    Default HSER Problems

    Good day every one!
    I have a problem (that none of my teachers even can solve) so i was hopeing that some one here can help me!
    I use a PIC 16F877A and i want it to take / recive and send information. Basicly im just doing small programs trying to see how things work right now.
    Any how All work good but one thing!
    It only recive 3 bytes! (even if i transmit 20)

    This is the test program code:

    DEFINE LOADER_USED 1

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 2400

    DEFINE OSC 4

    Char VAR BYTE[9]

    main:
    HSERIN [char]
    PAUSE 100
    HSEROUT [char]
    RCSTA.4 = 0
    RCSTA.4 = 1
    GOTO main

    END

    basicly im transmiting this (15bytes):
    Hej på dig pic

    And recive this (3bytes):
    Hej


    Thanks in advance!

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


    Did you find this post helpful? Yes | No

    Default

    LMAO! and they're teacher? Really???

    First of all i would suggest you remove the PAUSE 100 and use something like
    HSERIN [STR char]
    HSEROUT [STR char]

    refer to HSERIN/HSEROUT section of the manual. the above may miss something in.


    You can also try this one.. simple...
    Code:
            DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
            DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
            DEFINE HSER_SPBRG 25  ' 2400 Baud @ 4MHz, 0.17%
            DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
            Main var byte
    
    Main:
            Hserin [Char]
            Hserout[Char]
            GOTO Main
    Steve

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

  3. #3
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Good day. Thanks alot! Yes that person is a teacher. Any how i will stick around on this website and if i have more questions im sure i will get more good answares! Thanks alot again!

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


    Did you find this post helpful? Yes | No

    Default

    so now you really want to learn french, move 'round Montreal and be one of my student ???

    You're welcome, good luck, and don't give up!

    pssst: suggest to your teacher to come here as well
    Steve

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

  5. #5
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Hehe Maybe if i had time and money i could come and learn more about PIC but im poor and dont have alot of time .
    And no i dont ever give up!

    Hehe dont know if i dare to ask him if he wants to (my teacher that is).

    Thanks again!

  6. #6
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Good day every one!

    I have a new problem now .
    I want a led to be on for 5sec. How ever pause and HSER dont work together. Any sugestions?

    This is the program:

    DEFINE LOADER_USED 1

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 2400

    DEFINE OSC 4

    Char VAR BYTE
    LEDB var PORTD.1
    LEDG var PORTD.2
    LEDR VAR PORTD.4

    main:
    GOSUB standby
    LOW LEDB
    HSEROUT [STR char \1]
    HIGH LEDG
    PAUSE 5000
    LOW LEDG
    RCSTA.4 = 0
    RCSTA.4 = 1
    GOTO main

    Standby:
    High ledb
    HSERIN [str char \1]
    RETURN

    Error:
    END

Similar Threads

  1. My USART problems..
    By Glenn in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 31st July 2009, 01:00
  2. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 09:03
  3. bootloader Freqout problems
    By handgio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2007, 13:38
  4. Goto inside a gosub??? Problems...
    By leonel in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th October 2005, 12:17
  5. HSEROUT Problems
    By SergioRM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th April 2005, 23:17

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