SERIN2 = ok, HSERIN = no!


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    I Think HSERIN only speaks TRUE and likes a nice pull up resistor, just to keep it honest. The max232 would invert it, NO?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Some PIC have the option to select true or inverted.

    Ioannis

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Quote Originally Posted by Ioannis View Post
    Some PIC have the option to select true or inverted.

    Ioannis
    Don't know what I saw, I thought he was working with a 16F628 . . . still I did not know this anyway. Thanks to you and Walter.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Yup! Adding "DEFINE HSER_CLROERR 1" has solved the "hanging" problem.

    As I previously set the RCSTA.1 = 1, I wrongly thought this would handle the automatic overrun. I should have noticed the "Read-Only" flag on this bit in the datasheet.

    BTW, what exactly does "DEFINE HSER_CLROERR" 1 do? Where can I find information about what other DEFINE commands do?

    NB: my apologise Demon; I missed your advice for a pull-up in an early post

    Final working code is HSERIN-EUART-test_18F2420.zip
    Roger

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Quote Originally Posted by flotulopex View Post
    Yup! Adding "DEFINE HSER_CLROERR 1" has solved the "hanging" problem.

    As I previously set the RCSTA.1 = 1, I wrongly thought this would handle the automatic overrun. I should have noticed the "Read-Only" flag on this bit in the datasheet.

    BTW, what exactly does "DEFINE HSER_CLROERR" 1 do? Where can I find information about what other DEFINE commands do?

    NB: my apologise Demon; I missed your advice for a pull-up in an early post

    Final working code is Attachment 6366
    From the book "As the hardware buffer only has 2 byte input buffer, it can easily overflow if charactors are not read from it often enough. When this happens, the USART stops accepting new characters and needs to be reset. This error can be reset by toggling the CREN bit in the RCSTA register. A DEFINE can be used to automatically clear this error. However you will not know that an error has occured and characters may have been lost."
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Quote Originally Posted by Archangel View Post
    ...However you will not know that an error has occured and characters may have been lost.

    Ah, and this must be where a checksum comes it to play?

    Robert

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    ...Where can I find information about what other DEFINE commands do?
    Can someone please tell?
    Roger

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Believe it or not but they are actually listed in the manual. I know - who would've thought... ;-)
    In my 2.60 book they are in Appendix B and in the PBP3 book they are in section 8.7

    And, DEFINE is not a command in that it does not execute at runtime. It's a compiler directive that tells the compiler how and what code to generate. This means that you can not use DEFINE to change a setting (like for example the parity for the USART) at runtime.

    /Henrik.

  9. #9
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Thanks ;-)
    Roger

  10. #10
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Based on the code in post #12, I removed the WAIT modifier to be able to see what happens on each try (= display anything data that comes into the PIC): HSERIN[STR GPS_D\6].

    Quote Originally Posted by Archangel View Post
    ...and likes a nice pull up resistor...
    I removed the MAX232, added a 10k pull-up on PORTC.7 (PIC's RX pin) and changed BAUDCON to % 01001000 (not inverted). It works now!!!


    I re-modified the code to: HSERIN [WAIT("$GPGGA,"),STR GPS_D\6]

    I now can see "HH:MM:SS" as it should.

    Nevertheless, I have my PIC running for more than an hour now and it often hangs (= time is no incrementing every second anymore) and starts overs maybe 10 or 20 seconds later. Seems that the data signal is just at the limit the PIC can "read" it properly. This does not happen in my SERIN2 mode.

    With the oscilloscope, I measure 4,7VDC for the highest data signal level on PORTC.7 while the PIC and the GPS module are powered by the PICKit2 and its 4,95VDC from USB.

    I think I will choose to stay on the SERIN2 version since it looks more "reliable" and, as already said, needs less components.
    Last edited by flotulopex; - 25th March 2012 at 10:08. Reason: typo
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: SERIN2 = ok, HSERIN = no!

    Quote Originally Posted by flotulopex View Post
    Nevertheless, I have my PIC running for more than an hour now and it often hangs (= time is no incrementing every second anymore) and starts overs maybe 10 or 20 seconds later.
    That sounds more like a USART buffer overflow.
    If it isn't cleared ... it will hang.

    Try adding ...

    DEFINE HSER_CLROERR 1 ' clear overflow automatically
    DT

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