Question about SERIN / SEROUT and why I have to send commands twice?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72

    Default Question about SERIN / SEROUT and why I have to send commands twice?

    I have an odd problem with SERIN and SEROUT in that to get them to work, I often times, if not always have to send my command to the receiving PIC or device twice in order to get any kind of action going.

    I've had this problem in the past when I attached a PIC to a serial to alarm panel control bus converter. The device was supposed to let you connect some unspecified home automation widget to the alarm panel and it simply converted whatever serial commands to Superbus 2000 (whatever protocol that really is, I don't know, differential lines, I know that). The thing wanted to check in with whatever you had connected with it once every couple of seconds via an ACK /NAK back and forth if you weren't updating it with commands.

    So I connected a PIC 16F648A to it rather than a home automation device just to play around. I only ever got around to having it reply with the required NAK every time it would query the PIC. But I would have to send the NAK twice to get it to work.

    I recently have been using RealTerm to talk to a 18F2320 via a SERIN that looks like
    Code:
    SERIN PORTC.0,2,[*],W0,W1,W2
    and as long as it sees the "*", it replies with an ACK. BUT I have to send every command from RealTerm Twice....

    Is there something I'm missing? It's really kind of annoying. I know I can just double up the commands to make it work, but I don't think it's right and a waste of code space.

    Thank you ahead of time for your thoughts and opinions.

    I always make it a point to stress how important you guys are all to me. Even if you've never directly replied to my questions, I've probably read something of yours and it's help me out along the way. Even if you thought you were just asking a "dumb" question, I probably had that question at some point too, and therefore you've helped me. besides, there really are no dumb questions.

    I really care about this forum and it's members - There's been a lot of guys that were on a whole 'nother plane of thinking about this stuff that either are no longer with us, or have moved on for whatever reason and that makes me sad. But I see a lot of people starting to fill those shoes, or who are still with us that make me proud to be a part of the community.

    You're doing electronics and playing with microcontrollers, and no matter your level, that sorta automatically makes you smarter than the average bear! So be proud of yourself for that!

    There's been some newer micro's (dev boards really) on the block that seem to get all the love these days. And while they are just a different tool, like any other, I honestly feel PICBASIC and PICs are where it's at and we should take pride in our community and help others whenever we can. And also be patient and understanding that electronics and microcontrollers are a pretty difficult subject to grasp, else everyone would be doing it!

    So again, thank you for helping me, but thank you for helping all of us. You are awesome!

    /rant

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Question about SERIN / SEROUT and why I have to send commands twice?

    What else is your code doing? The chip is probably busy when the packet is first sent and has not gotten to the WAIT yet??

    If the data must be acted upon the first time you may want to consider using the hardware port and an interrupt.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Serin Serout Help
    By MangoKid in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 13th December 2010, 20:00
  2. Sending AT Commands using SEROUT
    By stuart_penman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th May 2008, 20:38
  3. Pic16f84(a) w/20 Mhz Osc Serin/out commands with PBC
    By RichardC in forum mel PIC BASIC
    Replies: 3
    Last Post: - 27th February 2006, 05:21
  4. Faster baud rates with SEROUT commands
    By TurboLS in forum PBP Wish List
    Replies: 1
    Last Post: - 19th February 2005, 10:05
  5. Debug vs SerOut Commands
    By EShatara in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th November 2004, 05:16

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