serout2 help please...


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53

    Default serout2 help please...

    I am pulling my hair out trying to get SEROUT2 to work at 9600. I am using a 18F2220 with a 20MHz crystal. Hserout works fine, I can not get serout2 to work at all. I have tried it on portC.6 with hserout disabled and it still does not work. What am I missing. I am using level converter cables, I know they work because when I exchange them with they both work with the hserout. Hopefully its nothing to do with B.1 being an interrupt, I tried both disabling the interrupts, no luck. I only have B1,B0, B2, and A3 available on this board (was planning on B1 being Tx and B0 as Rx, I am using the hserout for another device, so I need the serout2 to work with it). Any ideas. Many thanks! Charlie



    @ __CONFIG _CONFIG1H, _HS_OSC_1H
    @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    @ __CONFIG _CONFIG3H, _MCLRE_ON_3H
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L


    DEFINE OSC 20 'Oscillator speed in MHz: 3(3.58) 4 8 10 12 16 20 24 25 32 33 40


    PORTA = %00000000 ' output logic at power-up
    PORTB = %00000000 ' output logic at power-up
    PORTC = %00000000 ' output logic at power-up


    ' Set up serial UART
    define HSER_RCSTA 90H ' Set Receive Status and control register
    DEFINE HSER_TXSTA 24H ' set transmit status and control register
    DEFINE HSER_BAUD 9615 ' 9615=9600Kbps,19231=19.2Kbps


    ' Define Analog parameters
    ADCON0 = %00010001 '
    ADCON1 = %00001011 ' Anolog AN0-AN3, all else digital
    ADCON2 = %10000111 ' right justify result
    CMCON = %00000111 ' Comparators OFF to allow inputs on pins CMCON = 7


    INTCON = %00000000 ' all interrupts OFF


    mainloop: ' Main program loop
    toggle PORTB.3
    hserout ["hserout", 10 ,13]
    pause 10
    SEROUT2 PORTB.1,16468,["SEROUT2", 10 ,13]
    pause 10
    SEROUT2 PORTB.1,84,["SEROUT2a", 10 ,13]
    pause 250
    goto mainloop

  2. #2
    Join Date
    Aug 2005
    Posts
    95


    Did you find this post helpful? Yes | No

    Default

    I think you need to invert the serout2 signal from your pic for it to work with your RS232 to TLL level converter. To prove it just connect your pic directly to your RS232 port on your PC via a 1K resistor. Then try your serout2 command again.

    Sphere

  3. #3
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    Thanks for the response. I tried the resitor, no luck. I also tries setting the baud/node number to 84, which should be the same as 16468, except true.

  4. #4
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    Well I tried a new chip, which I was convinced was not the trouble, but it was. Another umpteen hours down the drain. I have no idea what was wrong with the other chip. BTW, you were right with the inversion, mode number should be 84.

Similar Threads

  1. Serout and 18F87J50
    By Glenn_Webber in forum Serial
    Replies: 8
    Last Post: - 20th November 2009, 14:26
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 16:46
  3. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  4. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38
  5. TMR1 interrupt question
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th February 2006, 03:02

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