SERIN Not Working, SEROUT Working


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    50

    Default Serin

    Quote Originally Posted by mackrackit View Post
    Code:
    ADCON1 = %00001111 'turn off adcs set to digital i/o
    The above line takes over after the configs so no matter what PBADEN is the pins should be digital.

    You have
    Code:
    @ CONFIG PBADEN = ON ' turn off port b analog inputs
    but you want to set it to OFF if you want it digital on POR
    From the P18F4520.INC

    Like Darrel, it has been awhile since I have used SERIN. You may want to try a simple routine sending just one variable to trouble shoot this.

    The limiting resistor like the manual shows is all you need. Pull the diode.

    If I think of something else I will let you know.

    I pull the diode, thanks. I'll keep on trying, thanks for you help.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    I bugged together a test because I can not remember.

    From a terminal on both of the following examples I am sending
    Code:
    83,79
    Example #1
    Code:
    V1	VAR	BYTE
    V2	VAR	BYTE
    T_MAIN:
    SERIN PORTC.7,N2400,V1,V2
    PAUSE 1000
    SEROUT PORTC.6,N2400,[V1,V2,10]
    PAUSE 250
    GOTO T_MAIN
    Displays
    83

    Example #2
    Code:
    V1	VAR	BYTE
    V2	VAR	BYTE
    T_MAIN:
    SERIN PORTC.7,N2400,#V1,#V2
    PAUSE 1000
    SEROUT PORTC.6,N2400,[V1,V2,10]
    PAUSE 250
    GOTO T_MAIN
    Displays
    SO
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2010
    Posts
    50

    Default Finally - Success!

    Quote Originally Posted by cc1984 View Post
    I pull the diode, thanks. I'll keep on trying, thanks for you help.
    I made a reduced size test program and still got the same results. Finally, with nothing else to try I changed the SERIN pin from PORTB.7 to another pin I was not using (PORTC.1). Works like a charm.

    I guess it is either a bad chip or some obscure setting for portb.7 I missed. Thanks for all the help.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Quote Originally Posted by cc1984 View Post
    I made a reduced size test program and still got the same results. Finally, with nothing else to try I changed the SERIN pin from PORTB.7 to another pin I was not using (PORTC.1). Works like a charm.

    I guess it is either a bad chip or some obscure setting for portb.7 I missed. Thanks for all the help.
    Interesting. I still do not see the problem in your code (PORTB.7) so it must be hardware...
    Or maybe the wrong pin,,, typo???
    rcx var PORTB.7 'rs-232 input on portc.7
    Or a bad connection?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2010
    Posts
    50

    Default

    Quote Originally Posted by mackrackit View Post
    Interesting. I still do not see the problem in your code (PORTB.7) so it must be hardware...
    Or maybe the wrong pin,,, typo???


    Or a bad connection?

    Could be a bad connection. I have it installed on a test board. I am making the permanent board which should only be traces, not a bunch of wires. Hopefully, that will remove my ghost.

    Thanks for all the help, unfortunately the code was the fun part, drawing up the circuit and making the cca is not as fun.

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