weird RS232 problem......


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624

    Default Re: weird RS232 problem......

    Hi David,
    Do you have a link to the PLC in question and/or its documentation?
    If you know that the PLC does indeed respond with the 'K' then about the only thing I can think of is that the PLC responds so fast that the PIC doesn't have enough time to "setup" the SERIN command - by the time its ready to receive the 'K' may already be partly sent. I see you're running at 20MHz so I admit I'd be a bit surprised if it doesn't but it's a thought.

    You could try to

    I feel there might be some confusion. SEROUT2/SERIN2 are bit-banged serial routines, they don't use the USART in the PIC. You're using PortC.6 and PortC.7 (which are the USART pins) and you're setting registers associated with the USART as if the USART was being used for the serial communication - when using SEROUT2 etc it's not. If you're intending to use the USART then the commands to look for are HSEROUT/HSERIN

    Also, what's this?
    Code:
     pause 3000
        :STPCMD
    Shouldn't the colon be after the label (STPCMD:) ? Same thing with WNLDCMD (EDIT: Stupid forum, that should read colon DWNLDCMD, not a smiley...)
    I'd expect that to not compile without errors but apparently it does...

    /Henrik.

  2. #2
    Join Date
    Mar 2012
    Posts
    3

    Default Re: weird RS232 problem......

    Henrick,

    That fixed it ! I really appreciate the help.....I have 100+ hours into this programming and was stumped. I like to try and figure things out myself but it was getting frustrating. I have used the software serial commands before and had never used the hardware.


    I am using an Entertron Smart Pak PLC http://www.entertron.com/smart-pak.htm


    I am actually trying to make a SD card downloader for ladder programs and also a datalogger with the SD card.

    I am using a USB/RS232/SD card from olimex https://www.olimex.com/Products/PIC/...t/PIC-USB-STK/


    Henrick....once again thank you very much. I work for entertron and if you are ever looking for a PLC to play around with let me know.

    Thanks,
    David

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624

    Default Re: weird RS232 problem......

    Hi David,
    Great news! May I ask what exactly fixed it, did you switch to HSEROUT/HSERIN?

    Reading my own post it doesn't make sense to me as there seems to be something missing. It looks like I had an idea for you to try but never told you what it was... Oh well, it was early in the morning ;-) Anyway, I'm glad it's working for you.

    I'll check the Entertron website!

    /Henrik.

Similar Threads

  1. Weird Random problem
    By Del Tapparo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th August 2012, 23:06
  2. weird pulsout problem
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th January 2012, 20:39
  3. Weird code problem
    By Navaidstech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2009, 12:16
  4. Weird Problem
    By isaac in forum General
    Replies: 9
    Last Post: - 22nd September 2008, 20:30
  5. PIC18F got some weird problem?
    By NatureTech in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 19th February 2007, 17:18

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