12F683 Serial Comms


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default

    Looks very close.

    If you are still using a rs232, then you want True, if you are not, then just as you did, with inverted.
    http://www.scalerobotics.com

  2. #2
    Join Date
    May 2010
    Posts
    20

    Default

    Ah thanks for pointing that out. I was using a max232 with 'n' and not 't' :P

    Working code:

    Code:
    Include "modedefs.bas"
    
    OSCCON = %01100000      'set for 4mhz internal
    CMCON0 = 7              'TURN COMPARITORS OFF
    ANSEL  = %00000000      'Set A/D OFF
    ADCON0 = %00000000      'Analog converter OFF 
    
    rcx var GPIO.4 'input pin
    tcx var GPIO.1 'output pin
    
    stat VAR byte
    
    Main:
    serin rcx,t2400,STAT
    pause 100
     SEROUT tcx,t2400,[stat]
    GOTO Main
    END
    Is a max232 needed? I haven't had much success without it in the past but I might consider trying to lose it since space is a bit tight in the dongle case.

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default

    Quote Originally Posted by ross246 View Post
    Is a max232 needed? I haven't had much success without it in the past but I might consider trying to lose it since space is a bit tight in the dongle case.
    When you use a hardware serial port on a pic16 device, you need an RS232. If you use hardware serial on a PIC18, then you can invert the bits to get away without one.

    For degug or serin/out you don't need one. You can follow the directions in the manual for the resistor size to protect your pic.
    http://www.scalerobotics.com

  4. #4
    Join Date
    May 2010
    Posts
    20

    Default

    Awesome thanks so much for your help. Just got to search through the manual now. 10k sticks in my head for some reason but I will check.

    Thanks again.
    Last edited by ross246; - 17th November 2010 at 16:53.

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default

    Quote Originally Posted by ross246 View Post
    Awesome thanks so much for your help. Just got to search through the manual now. 10k sticks in my head for some reason but I will check.
    Not a problem, great to see you got it going.

    It's 1K resistor for serout, and 22K (or so) for serin pins.
    http://www.scalerobotics.com

Members who have read this thread : 1

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