SEROUT2/SERIN2 Problem


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default T2400 needs a MAX232 RS232 driver

    I think you will find T2400 only works/receives if you have a MAX-232 chip.

    Try N2400 and at the start of the sending, condition the line with

    HIGH SO
    pause 5
    serout2 ............

    HTH
    Brian

  2. #2


    Did you find this post helpful? Yes | No

    Default I think you have mixed SEROUT and SEROUT2

    Disregard the post above - it is right for SEROUT however.

    I think you have mixed up the command syntax for your SEROUT2. I think your command line should be something like...

    serout2 So, 396,["INIT", "1111", "2222", "333", "444"]

    HTH
    Brian

  3. #3
    Join Date
    Jun 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Thanks Brian,

    The T2400 is a constant from modedefs.bas that I've included in my program (though I have tried using 396 and various other modes as well).

    I've had easy success using this type of comms before between a pair of 16F's (a serial LCD module for example) but the 18F doesn't seem to like it so I guess I've done something wrong in my code.

    Is there anything tricky about using porte for serial comms?

    The only other thing that might have an effect is I'm running the projects at different speeds but I've used defines in both to tell PBP the clock speed.

    Regards

    Thirsty

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


    Did you find this post helpful? Yes | No

    Default

    Brian is spot-on about using 396 VS T2400 with SERIN2/SEROUT2. The constant serial mode
    definitions in MODEDEFS.BAS like T2400 are for use with SERIN/SEROUT only.

    PORTE on this PIC has A/D. Have you disabled A/D so these pins can be used for digital I/O?
    Regards,

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

  5. #5
    Join Date
    Jun 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce.

    I tried 396 (and a bunch of other modes) but no joy.

    I have disabled the A/D and set porte to all digital IO.

    I've read on this site that using an internal osc is a bad idea for asynch comms and I am using an internal osc on the 18F so I guess that could be the problem.

    I guess I'll have to give this idea a miss and try synch comms using shiftin/out and write my own slave routine for the 18F.

    Thanks for the replies anyway,

    Regards

    Thirsty

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    If you can't get SERIN2 to work, I'd skip the idea of writing your own Synchronous Slave routine.

    You keep saying that you've set all ports to digital.
    How did you do that? What statements did you use?
    The method of turning off analog ports varies from PIC to PIC.
    Are you sure you got the right ones?

    Did you set TRISE.
    If so what did you set it to?
    I've seen people go TRISE=%11111111, thinking that they are setting PORTE to all input, but what it really does is turn on the PSP module, which along with other problems, disables PORTE.2 for general I/O.

    Don't dismissed 396 as being correct, simply because you've tried it and it didn't work. 396 is the correct mode number, not T2400.
    <br>
    DT

  7. #7
    Join Date
    Jun 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Darrel, point taken.

    Here is how I've set the configs (18F4525):

    DEFINE OSC 8


    OSCCON = %01110010
    CMCON = %00000111
    ADCON0 = %00000000 'Turn off A/D
    ADCON1 = %00001111 'Make All ports Digital IO
    TRISA = %00000000 'PortA is all outputs
    TRISB = %00000000 'PortB is all outputs
    TRISC = %00000000 'PortC is all outputs
    TRISD = %00000000 'PortD is all outputs
    TRISE = %00000110 'PortE.0 is output, 1 and 2 are inputs

    As I've said though it seems lots of experienced guys on this forum advise not to use asynch comms when relying on an internal clock that's why I made my last comment.

    Any further observations would be appreciated though,

    Thirsty

Similar Threads

  1. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 20:48
  2. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59
  5. weird 12F629/675 problem
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th October 2004, 01:08

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