SEROUT2/SERIN2 Problem


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    12

    Default SEROUT2/SERIN2 Problem

    Hi All,

    I'm hoping someone can shed some light on a problem I'm having.

    I have 2 projects (one PIC18F4525 based and one PIC16F913 based). I have connected the two projects together via port b.3 on the 16F and port e.2 on the 18F. I have a 10K pullup res on this line. I've disabled the AD on the 18F and made porte digital IO.

    Here is the serial out code on the 16F:

    serout2 so, T2400,["INIT", "1111", "2222", "333", "444"]

    and here is the serial in code on the 18F:

    Serin2 Si,T2400,[WAIT ("INIT"), str RHET \4, str LHET \4, str RHspd \3, str LHspd \3]

    The variables are defined as byte arrays with dimensions of 4,4,3 and 3 respectively.

    Now the problem is the code will not go past the "wait" in the serin2 line on the 18F. I've measured the input to the 18F's e.2 pin and there is activity on that pin as expected.

    I assume I've not set a config bit somewhere but I've read through the datasheet many times and I can't see what I'm missing.

    Any ideas?

    The 18F is working as it displays data on some LED's so I know everything is OK there.

    I'd appreciate it if anyone can shed some light,

    Thanks

    Thirsty

  2. #2


    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

  3. #3


    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

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

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

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

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 : 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