Manometer project continued.


Closed Thread
Results 1 to 13 of 13

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 Re: Manometer project continued.

    Code:
        NUM VAR WORD
        NUM = 12345
        NUM_DIG VAR BYTE
        
        BOOT:
        SEROUT2 TX,BAUD,[$d,$a]
        'RETURNS 12345
        SEROUT2 TX,BAUD,["NUM= ",DEC NUM,$d ,$a]
        'RETURNS 345
        SEROUT2 TX,BAUD,["NUM= ",DEC3 NUM,$d ,$a]
        NUM_DIG = NUM DIG 4 'RETURNS 1
        SEROUT2 TX,BAUD,["NUM_DIG4= ",DEC NUM_DIG,$d ,$a]
        NUM_DIG = NUM DIG 3 'RETURNS 2
        SEROUT2 TX,BAUD,["NUM_DIG3= ",DEC NUM_DIG,$d ,$a]
        NUM_DIG = NUM DIG 2 'RETURNS 3
        SEROUT2 TX,BAUD,["NUM_DIG2= ",DEC NUM_DIG,$d ,$a]
        GOTO BOOT
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Apr 2011
    Location
    NSW, Australia
    Posts
    39


    Did you find this post helpful? Yes | No

    Default Re: Manometer project continued.

    Hi Dave,

    I think I understand where your heading with this.

    Where I can see a problem with what I am doing is I dont have a constant number of digits in the remainder. It could be 1,2,3 or 4 characters long, So DIG2 would pick the right number if the remainder was in the hundreds, but the wrong number if the result was in the thousands.

    If I remember back to Q Basic days there was a Left$ or Right$ and number of characters command, but I cant see anything like that in PBP.

    Am I seeing this right or not?

    aajgss

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


    Did you find this post helpful? Yes | No

    Default Re: Manometer project continued.

    If I remember back to Q Basic days there was a Left$ or Right$ and number of characters command, but I cant see anything like that in PBP.
    Nope...

    Try something like this.
    IF NUM_REM >= 9999 and <= 1000 THEN
    DIG3 NUM_REM

    IF NUM_REM >= 999 and <= 100 THEN
    DIG2 NUM_REM
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Apr 2011
    Location
    NSW, Australia
    Posts
    39


    Did you find this post helpful? Yes | No

    Default Re: Manometer project continued.

    Ah Yes,

    A good solution, thanks. Using that method I could also now look at the second digit and if >= 5 round up to the next value.

    aajgss

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