Getting SERIN2 to work?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Bob,
    Welcome to the forum !<br>
    Are you sure your PC is sending actual numbers and not ASCII characters ?
    I use REAL Term and using it I can select either format. Get it here for free:
    http://sourceforge.net/projects/realterm

    EDIT: Since I have never bothered to use SERIN2, what I am going to say is purely conjecture on my part.
    Serin2 receives 8 bits and an optional parity bit, word is 16 bits so try:
    Code:
    SERIN2 RXPin, 16780, [DEC MAX1A.highbyte,MAX1A.LowByte]
    I don't know if it will work, but PBP doesn't choke on it.
    Last edited by Archangel; - 14th March 2009 at 00:23.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default SERIN2 still hangs trying to fill a WORD variable

    Thanks Joe S.

    It will compile but it hangs up like the other efforts.
    I have considered a "resistor problem" and but only 1k receive and 1k transmit resistors work at all (the byte in, byte out test). That also agrees with the manual's recommendation.

    I cannot remember being this frustrated in at least 20 years!

    Why does it work so easily in a BS2 but seems impossible in a PIC?

    Thank you again for your suggestion. I will need all the help I can get.
    Bob

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobPigford View Post
    Thanks Joe S.

    It will compile but it hangs up like the other efforts.
    I have considered a "resistor problem" and but only 1k receive and 1k transmit resistors work at all (the byte in, byte out test). That also agrees with the manual's recommendation.

    I cannot remember being this frustrated in at least 20 years!

    Why does it work so easily in a BS2 but seems impossible in a PIC?

    Thank you again for your suggestion. I will need all the help I can get.
    Bob
    I always use a max232 between PC and PIC. You might try changing your mode to OPEN INVERTED instead of DRIVEN INVERTED mode 49548.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    You may want to show your code, the whole code, nothing but the code....well, maybe the configs too.

    Point is, we do not know what pins you are using or the setup.

    You say you are sure the PC is sending because of some program on the PC, have you checked the wires from PC to PIC? Maybe there is a blockage???

    Give something like this a try
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    OPPS. I hit submit before I was finished.

    Change the code to fit your needs.
    Code:
    SERIN2 PORTB.5,24972,[WAIT("A"),STR NUMS\16]	'7, Even
    
    X1 = (NUMS[1]-"0")
    
    X2 = (NUMS[3]-"0")
    
    X3 = (NUMS[5]-"0")
    
    X4 = (NUMS[7]-"0")
    
    X5 = (NUMS[9]-"0")
    
    X6 = (NUMS[11]-"0")
    
    X7 = (NUMS[13]-"0")
    
    X8 = (NUMS[15]-"0")
    LCDOUT $FE,1,DEC X1,DEC X2,DEC X3,DEC X4,DEC X5,DEC X6,DEC X7,DEC X8
    The above brings the ASC|| data into an array then then does a little parsing.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    I think that's what he is hoping to avoid doing, nevertheless it looks as if he will have to. I thought the highbyte / Lowbyte would work for non ASCII numbers though. If i can get some time I am going to play with this a little.
    Last edited by Archangel; - 14th March 2009 at 20:01.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Jan 2009
    Location
    Delaware
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Made some progress

    Joe S. and mackrackit,
    I have some success by going farther back to basics (sending ASCII numbers from a terminal). I'll try to post the code and results later today.
    Thank you for your help and patience,
    Bob

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 10:47
  2. SERIN2 digit parsing
    By skimask in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th January 2007, 00:15
  3. with 40 MHZ osc serin2 not work
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th August 2006, 23:56
  4. SEROUT2 and SERIN2 commands
    By bangunprayogi in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th August 2005, 10:03
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 13:03

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