strange problem with HSERIN


Closed Thread
Results 1 to 17 of 17

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default idle state

    Hi Beginner,
    One thing to check is the port's idle state. HSER* requires the port to idle HIGH so you will need a pull up resistor or the port will likely hang the program.
    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
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    One thing to check is the port's idle state. HSER* requires the port to idle HIGH so you will need a pull up resistor or the port will likely hang the program.
    Joe,

    Thanks for the heads up on that, but most of the samples I've come across have something like
    Code:
     IF RCIF THEN GOSUB xxxxx
    or
     IF RCIF=1 THEN GOSUB xxxxx
    If the pins are tied high then this will cause the code to constantly loop to the sections that deal with the comms. would it not be better to tie the pins to ground via resistors ?

  3. #3
    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

  4. #4
    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 ?

  5. #5
    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

  6. #6
    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?

  7. #7
    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