Decimal part from a Float - Page 2


+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20

Thread: Decimal part from a Float69 days old

  1. #16
    Member teo's Avatar
    Join Date
    Sep 2010
    Posts
    343
    Thumbs Up
    Received: 10
    Given: 1
    Total Downloaded
    7.87 GB

    0 Not allowed!

    Default Re: Decimal part from a Float

    k = 3.851
    Teo

  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. #17
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,890
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Decimal part from a Float

    Teo, would you show us how each of your variables are defined?

  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. #18
    Senior Member Mellbreak's Avatar
    Join Date
    Jun 2012
    Posts
    571
    Thumbs Up
    Received: 36
    Given: 27
    Total Downloaded
    4.63 GB

    0 Not allowed!

    Default Re: Decimal part from a Float

    And what device you are using.

  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.

  7. #19
    Member teo's Avatar
    Join Date
    Sep 2010
    Posts
    343
    Thumbs Up
    Received: 10
    Given: 1
    Total Downloaded
    7.87 GB

    0 Not allowed!

    Default Re: Decimal part from a Float


    Device = 18F45K22
    Declare Xtal = 4
    Config_Start
    FOSC = XT ;XT oscillator
    PLLCFG = OFF ;Oscillator used directly
    PRICLKEN = On ;Primary clock is always enabled
    FCMEN = OFF ;Fail-Safe Clock Monitor disabled
    IESO = OFF ;Oscillator Switchover mode disabled
    PWRTEN = OFF ;Power up timer disabled
    BOREN = SBORDIS ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
    BORV = 190 ;VBOR set to 1.90 V nominal
    WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS = 32768 ;1:32768
    CCP2MX = PORTC1 ;CCP2 input/output is multiplexed with RC1
    PBADEN = On ;PORTB<5:0> pins are configured as analog input channels on Reset
    CCP3MX = PORTB5 ;P3A/CCP3 input/output is multiplexed with RB5
    HFOFST = On ;HFINTOSC output and ready status are not delayed by the oscillator stable status
    T3CMX = PORTC0 ;T3CKI is on RC0
    P2BMX = PORTD2 ;P2B is on RD2
    MCLRE = INTMCLR ;RE3 input pin enabled; MCLR disabled
    STVREN = On ;Stack full/underflow will cause Reset
    LVP = OFF ;Single-Supply ICSP disabled
    XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    Debug = OFF ;Disabled
    Cp0 = OFF ;Block 0 (000800-001FFFh) not code-protected
    CP1 = OFF ;Block 1 (002000-003FFFh) not code-protected
    CP2 = OFF ;Block 2 (004000-005FFFh) not code-protected
    CP3 = OFF ;Block 3 (006000-007FFFh) not code-protected
    CPB = OFF ;Boot block (000000-0007FFh) not code-protected
    CPD = OFF ;Data EEPROM not code-protected
    WRT0 = OFF ;Block 0 (000800-001FFFh) not write-protected
    WRT1 = OFF ;Block 1 (002000-003FFFh) not write-protected
    WRT2 = OFF ;Block 2 (004000-005FFFh) not write-protected
    WRT3 = OFF ;Block 3 (006000-007FFFh) not write-protected
    WRTC = OFF ;Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF ;Boot Block (000000-0007FFh) not write-protected
    WRTD = OFF ;Data EEPROM not write-protected
    EBTR0 = OFF ;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
    EBTR1 = OFF ;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
    EBTR2 = OFF ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
    EBTR3 = OFF ;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
    EBTRB = OFF ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End

    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    ;Calculated Baudrate = 38462 @ Xtal 4MHz, Error = 0,16%
    RCSTA = 144 ; Enable continuous receive
    TXSTA = 36 ; Enable transmit, BRGH = 1
    SPBRG = 25 ; Baud Rate Generator Low Byte Value
    SPBRGH = 0 ; Baud Rate Generator High Byte Value
    BAUDCON.3 = 1 ; Enable the 16 bit Baud Rate Generator


    TRISA.0 = 0
    TRISA.1 = 0
    TRISB = 0
    TRISC.1 = 0
    TRISD = 0
    TRISE.3 = 0
    PORTA.0 = 0
    PORTA.1 = 0
    PORTB = 0
    PORTC.1 = 0
    PORTD = 0
    PORTE.3 = 0

    Declare Float_Display_Type = Fast
    Symbol EN_Sonda_temp PORTC.1
    Symbol k 3851
    Dim Temp_rec As String * 4
    Dim Temp[3] As Byte
    Dim Temp_Dec As Byte
    Dim Temp_D1 As Byte
    Dim Initial As Byte
    Dim MyIndex As Byte
    Dim RSondaTemp As Dword
    Dim RST0 As RSondaTemp.Byte0
    Dim RST1 As RSondaTemp.Byte1
    Dim RST2 As RSondaTemp.Byte2
    Dim Rez_PT1000 As Float
    Dim Rez_PT1000_1000 As Dword
    Dim Rez_PT1000_round As Byte
    Dim Produs As Dword
    Dim Intreg As Word
    Dim Temp_Intreg[4] As Byte
    Dim zecimale As Word
    Dim cucu As Byte
    GoTo Main:

    Main:

    'Clear Temp
    Clear Temp_rec
    MyIndex = 0
    Initial = 0

    Do
    Initial = HRSIn , {2000, timeout}
    If Initial = 13 Then Break
    Temp_rec[MyIndex] = Initial
    Inc MyIndex
    If MyIndex >= 3 Then
    MyIndex = 0
    EndIf
    Loop

    Temp[0] = Temp_rec[0] - 48
    Temp[1] = Temp_rec[1] - 48
    Temp[2] = Temp_rec[2] - 48
    Temp_Dec = (Temp[0]*100) + (Temp[1]*10) + Temp[2]
    Produs = k * Temp_Dec

    Temp_Intreg[0] = Dig Produs , 6
    Temp_Intreg[1] = Dig Produs , 5
    Temp_Intreg[2] = Dig Produs , 4
    Temp_Intreg[3] = Dig Produs , 3

    cucu = Temp_Dec - 2
    HRSOut "1" , cucu
    GoTo Main

    timeout:
    Temp_Dec = 0
    RSondaTemp = $FFFF
    HRSOut "zero"
    EN_Sonda_temp = 0
    GoTo Main


    Basically, it enters the timeout after the first loop of the Main loop.
    If you exclude the block:
    Temp_Intreg [0] = Dig Product, 6
    Temp_Intreg [1] = Dig Product, 5
    Temp_Intreg [2] = Dig Product, 4
    Temp_Intreg [3] = Dig Product, 3
    everything is OK.
    Thank you in advance,
    Teo




  8. 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.

  9. #20
    Member teo's Avatar
    Join Date
    Sep 2010
    Posts
    343
    Thumbs Up
    Received: 10
    Given: 1
    Total Downloaded
    7.87 GB

    0 Not allowed!

    Default Re: Decimal part from a Float

    Hi
    The problem is from the compiler.
    I have changed with the 3600 version and it is OK
    Previously I used 3736
    Thank you all,
    Teo

  10. 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. Display no decimal point on a float.
    By geoff_c in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 8th February 2017, 20:42
  2. Decimal Digit extract
    By John Drew in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 31st January 2017, 01:38
  3. Binary or decimal?
    By joesaliba in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 25th August 2008, 19:59
  4. 7segment Decimal Point Value
    By willim in forum Proton Plus Compiler v3
    Replies: 11
    Last Post: 26th April 2007, 19:49
  5. [SOLVED !] bcd to decimal
    By ADLIN SYSTEMS in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 31st March 2007, 14:24

Posting Permissions

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