SERIN2 buffer issues...


Closed Thread
Results 1 to 10 of 10

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi. I tried multiple waits (didn't know you could do this). it works a little better, but still not perfect.

    I set it up to snoop the data and post it on hyperterminal.

    This is what I get
    ?Q0 ' echo of my command to post 32bit encoder value into mailbox
    0B02 'the encoder value -*88
    00 'the 2 digit hex return, its the MSB so its zero in this example, but still can't get it
    + 'confimation sent from controller.

    I believe the issue is after I send the request to read the *88 register, by the time i get to the next line I may have missed some of it, I tried just waiting for a CR, but sometime I get down and read the CR before the *88, so then it gets out of sequence. My guess is the controller does not consistently respond back at the same time intertvals, so sometimes I get it all other times its quicker than my program (which is just one line). I also played around with putting a pauseus for different ammounts after the tx before the rx, but it did not seem to help.

    Another idea would be just to grab the encoder value versus each bit, but I don't know how to do this. its 32bit hex, but only the significant values are sent so I am not sure what to get. I am just relaying this information back to a VB program that I am sure I could use to convert the number to a decimal. I feel I may miss the first part of the response in some cases too.

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    Is there a way to reset the OERR flag other than serin2?

    does this doe anything. I can find very little info on it, but I saw it in the appendix of the picbasic book. I know the same thing exists for HSERIN, but it has a buffer to overflow, serin2 does not. define ser2_CLROERR 1

    what would be your suggestion for a dummy serin statement, should include waits, etc, or just try to capture a single byte regardless of the size?

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    OK. I have it working pretty good with the dummy receives after each tx to catch the junk and prevent overun. Every once in a while though it gets caught up in itself probably from missing a readding and then over running the buffer. How can I check to see if I am in error state before proceeding to the next set of instructions?

    somehting like this won't work (will it) since I am not using the hardware USART
    OERR VAR RCSTA.1 ' Alias OERR (USART Overrun Error Flag)

    I am using a PIC18F2220 with the internal osc. What would be the way of setting up and checking for an error state and what would be the best way to clear it. With all these dummy serin statements my code space is going to get tight...

    Thanks for all the help thus far. I think I am almost there!

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


    Did you find this post helpful? Yes | No

    Default

    BTW, I don't need to recover the lost data, just reset. Its not a big deal to miss loop of data here and there. THe issue I have is once it starts erroring it kinda cascades and keeps getting worse as I go down the line getting other data readings. Thanks again.

Similar Threads

  1. PC to EUART on pic 16F688
    By docaberle in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 25th October 2008, 07:33
  2. EDE702 where?
    By karenhornby in forum General
    Replies: 18
    Last Post: - 16th June 2008, 23:04
  3. Need idea hove to..?
    By phoenix_1 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 14th May 2008, 19:41
  4. Student Project
    By aggie in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 8th July 2006, 09:56
  5. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 17:04

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