Broken Case statement Logic


Results 1 to 10 of 10

Threaded View

  1. #6
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Default

    It is coming from an array of 2 HEX bytes, which are then converted to binary. In the case I am using, the

    the value '44308' is what TRACID_ID is in this example..

    SSD4= (ssmax[1]>>4)
    SSD3= (ssmax[1] & $f)
    SSD2= (ssmax[0]>>4)
    SSD1= (ssmax[0] & $f)

    TracID_D=(ssd4*4096)+(ssd3*256)+(ssd2*16)+ssd1' convert to dec

    TC1=(TracID_D/1600)

    I have attached a spreadsheet that does this also. It uses an "INT" function to keep the result of the TracID_D/1600 rounded to 27. In PBP I need an equivalent function. Otherwise the answer is 27.7 and that messes up the CASE statement.

    IN the excel example, if you remove the INT function, it gives 27.7 also.

    TG
    Attached Files Attached Files

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  3. Write Onewire data toa I2C memory / read ASCI
    By Eugeniu in forum mel PIC BASIC Pro
    Replies: 67
    Last Post: - 16th November 2008, 19:19
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05

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