Select... Case not producing correct result


+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    842
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Select... Case not producing correct result

    I noticed this was not producing the expected result, I just thought I would post here before putting it on the anomaly section in case I'm doing something silly!



    Compiler version 3.7.3.6


    Code:
    Device = 24FJ64GA004
    Declare Xtal = 16
    
    '***************************************************************************************** 
    Declare Hserial_Baud = 57600             
    Declare HRSOut1_Pin = PORTC.9           
    PPS_Output(cOut_Pin_RP22, cOut_Fn_U1TX)
    
    '*****************************************************************************************
    
    Dim v1 As SWord = -3
    '*****************************************************************************************
    Start:
    
    
    
    If v1 > 0 Then HRSOut1 " >0 "
    If v1 < 0 Then HRSOut1 " <0 "      'get this output
     
    Select v1
    
    Case 0
        HRSOut1 " equal "
    Case > 0
        HRSOut1 " greater "           'get this output
    Case < 0
        HRSOut1 " less "
        
    EndSelect
    
    
    
    
    
    DelayMS 1000
    GoTo Start
    '**********************************************************************************************
    Config Config1 = JTAGEN_OFF, GCP_OFF, BKBUG_OFF, COE_OFF, ICS_PGx1, FWDTEN_OFF, WINDIS_OFF, FWPSA_PR128, WDTPOST_PS512
    Config Config2 = IOL1WAY_OFF, COE_OFF, IESO_OFF, FNOSC_FRCPLL, FCKSM_CSECME, OSCIOFNC_ON, POSCMOD_NONE, SOSCSEL_SOSC

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    195
    Thumbs Up
    Received: 8
    Given: 5
    Total Downloaded
    331.75 MB

    0 Not allowed!

    Default Re: Select... Case not producing correct result

    I may say something incorrect for this case, but I think, as rule of thumb, that Select doesn't consider negative numbers.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Select... Case not producing correct result

    Not specified in the manual but personally I would even use a signed variable.
    George.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Possible problem with Select Case Case etc
    By charliecoultas in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 6th April 2011, 16:48
  2. select case else
    By crankshaft in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 27th July 2008, 13:54
  3. Select...Case
    By johngb in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 3rd March 2007, 14:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts