HSERIN and STR - character encoding


Closed Thread
Results 1 to 14 of 14

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Something like this will strip the 3s from 3132333435363738 and write to the variable X1 -X2 so on, 1,2,3,4,5,6,7,8

    Might help you figure out what is going wrong. ?
    Code:
    [WAIT("A"),STR NUMS\16]	
    
    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")
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jan 2007
    Posts
    39


    Did you find this post helpful? Yes | No

    Default Thanks

    Hello, Thanks, however, this doesnt answer and explain my problem. What you are doing is simply substracting ascii value 0 ( which should be $30 ) from the character e.g. 1 ( which should be $31 ) so then as a result, you have 1 in the variable. But my issue is wrong ascii code, which is received using the STR function. If in the input string, I have e.g. character "1", I should receive $31, but I am receiving something else, that's the problem. And because I don't know, where in the input string is the character "0" - "9", then I cannot do the trick like you are doing.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default

    From where do you get this characters?

    Ioannis

Similar Threads

  1. hserin and sms controller
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 10th February 2010, 15:49
  2. Instant Interrupts and HSERIN
    By Rob in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 31st January 2009, 05:13
  3. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 11:48
  4. PIC HSERIN problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 20th July 2008, 11:08
  5. HSERIN seems to fail and I can't see WHY
    By Jumper in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th August 2006, 17:51

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