16F877A HSERIN problem


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1

    Default 16F877A HSERIN problem

    I'm using a 16f877 with max 232 at 4mhz

    I'm having problems reading multiple variables in 1 Hserin string
    It works, but after some times it hangs so I think there is a buffer overflow
    What worries me is that when i measure with an osciloscope, there are pulses on portc.7 the UART RX even with no max232 chip connected ???

    Here is a part of the code:

    DEFINE HSER_RCSTA 90h ' enable serial port,
    ' enable continuous receive
    '
    define HSER_TXSTA 24h ' enable transmit,
    ' BRGH=1
    '
    define HSER_SPBRG 103 ' set baudrate to 2400
    DEFINE HSER_CLOERR 1 ' automatic clear overrun error

    TRISB = %00000000
    'OPTION_REG.7 = 0 ' Enable PORTB pullups
    TRISC = %10000000
    TRISD = %00001111
    TRISE = %000

    loop:
    Hserin 500,LCD,[wait ("TAR"),dec3 var1,wait ("ANT"),DEC3 var2,wait ("AUX"),DEC3 var3,wait ("EXT"),DEC3 var4]


    LCD:
    pause 10
    Lcdout $fe, 1 ' Clear screen

    Lcdout "VAR1: ",#VAR1," VAR2: ",#var2

    Lcdout $fe, $c0, "VAR3: ",#VAR3," VAR4:",#VAR4

    Goto loop

    Any Idea ?

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Hi all,

    Still suffering the same problem, what I measured on the RX UART pin

    are negative pulses aproximatly 25 uSecondes long or 40khz

    Does it has something to do that I have to enable the Uart or stop other functions on this pin ?

    See my software example below

    Thanks all

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


    Did you find this post helpful? Yes | No

    Default

    Try changing
    Code:
    DEFINE HSER_CLOERR 1 ' automatic clear overrun error
    to
    Code:
    DEFINE HSER_CLROERR 1 ' automatic clear overrun error
    the timeout may screw or not the whole thing, try to remove it first. Once you get it working, you may decide to use interrupt instead.

    If it was for me, i would probably use a single WAIT and parse the whole string at the end to validate the result.
    Last edited by mister_e; - 25th October 2006 at 14:55.
    Steve

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

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi Mister_E

    Unfortunatly no solution

    So i'm wondering if someone has a working code to receive multiple items
    in a row via Serin including the full configuration for the 16F877A

    I also changed the multiple Wait's by a single Wait statement and
    some Skip 1 's

    I also changed the baudrate to 2400bd as i was using a 4mhz clock

    than I even changed the crystal to 20 mhz and set the define osc 20

    I still measure the same pulses on the RX UART portc.7

    So i think something might be wrong with the configuration

    So No result i'm a bit lost now !!!

    I hope the serial specialists can help me

    Walter

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


    Did you find this post helpful? Yes | No

    Default

    Who/what send the data to your PIC?

    What about if you skip the MAX232 and use SERIN/SERIN2/DEBUGIN instead?
    Steve

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

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Hi

    I use codestudio and it has a build in terminal program

    Still dont see where those pulses on the RX port com from

    Even if I disconnect the MAX232 there are some pulses

    I really think there is a config problem, I also asked the question to Mel
    from Melabs

    Any hints Welcome

    I even checked versions of PBP to be sure there are no updates
    i'm using 1.43

Similar Threads

  1. 16F877 HSERIN problem with 3th party software
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th March 2009, 17:11
  2. HSERIN problem
    By eggman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th October 2007, 21:31
  3. Replies: 3
    Last Post: - 12th February 2007, 18:32
  4. 16F877a Interupt driven Hserin
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd November 2006, 00:38
  5. HSERIN problem
    By s_syafiq81 in forum Serial
    Replies: 2
    Last Post: - 1st January 2006, 11:05

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