strange problem with HSERIN


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The USART RX pin should definitely idle high, but this routine has some major issues;
    Code:
    BEGIN: 
       For K = 240 TO 240  ' <-- BIG problem here
        teller = teller + 1   
        ADRESS = K
        AANTAL = 1 
        buffero(K) = teller  ' <-- there is no buffero(240)
        GoSub WEGSCHRIJVEN
        PauseUs 200
        ADRESS = K
        AANTAL = 1 
        GoSub OPHALEN 
        IF OK = 1 Then
         lcdbufO(K) = bufferi(K) ' <-- same issue here
         LCDBUFI(K) = BUFFERO(K) ' <-- and here
         GoSub LCD 
         OK = 0
        GoTo HIER1
        EndIF
       LCDBUFO(K) = 0
       LCDBUFI(K) = 0
       GoSub LCD
    HIER1:  Next
    K = 240, but your largest array variables are only 6 bytes. I.E. buffero(0) to buffero(5) would be the last byte available in your buffero array.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Uhmm... just looked at the schematic in the EasyPIC5 manual, the RX line is connected direct to the R1Out pin on the Max232 - the TX pin to the T1in pin which is tied to Vcc via 1K resistor. I assume the MAX232 will handle the logic level of the RX pin ?

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I assume the MAX232 will handle the logic level of the RX pin ?
    Yes it will. The MAX232 has an internal pull-down on the R1in side of the inverter http://www.rentron.com/Files/bMAX232.gif
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Aug 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    The USART RX pin should definitely idle high, but this routine has some major issues;
    Code:
    BEGIN: 
       For K = 240 TO 240  ' <-- BIG problem here
        teller = teller + 1   
        ADRESS = K
        AANTAL = 1 
        buffero(K) = teller  ' <-- there is no buffero(240)
        GoSub WEGSCHRIJVEN
        PauseUs 200
        ADRESS = K
        AANTAL = 1 
        GoSub OPHALEN 
        IF OK = 1 Then
         lcdbufO(K) = bufferi(K) ' <-- same issue here
         LCDBUFI(K) = BUFFERO(K) ' <-- and here
         GoSub LCD 
         OK = 0
        GoTo HIER1
        EndIF
       LCDBUFO(K) = 0
       LCDBUFI(K) = 0
       GoSub LCD
    HIER1:  Next
    K = 240, but your largest array variables are only 6 bytes. I.E. buffero(0) to buffero(5) would be the last byte available in your buffero array.
    I tried to change the For K = 240 TO 240 to For K = 0 TO 5 , but it does not make any difference.

    The chip still keeps running VERY slow (like 25 seconds startup time) when I'm using the HSERIN command.

    ---------------------

    The RS232 schematic is ok, I'm using the same for other PCB's with 16f887 and 16f882 chips where it works fine.
    ----------------------

    Also changing the bit TRISG<2> = 1 does not solve this problem.

    Any more suggestions?

  5. #5
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    I did some tests with that chip and also using a rs485 chip to test. You talked about rs232 and a direction (TX_ENABLE) and when I look at the code I think it's RS485, but that is not an issue.
    I also discovered that indeed the chip will not startup when using HSERIN and the RX pin of the uart is high.
    I put a 10K resistor from the RX pin of the picchip to ground and now the program is starting up normaly.
    I hope it will help you.

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