Menu

18F45K80 SQRT

Help
Mikam
2015-12-11
2015-12-11
  • Mikam

    Mikam - 2015-12-11

    Hi All
    Using sqrt(100) GCB answer is 1000 surely should be 10. Help.
    Thanks in advance.

    ;Chip Settings
    

    *#chip 18F45K80,8

    #include <maths.h></maths.h>

    ;Defines (Constants)

    define LCD_IO 8

    define LCD_RW PORTD.6

    define LCD_Enable PORTD.7

    define LCD_RS PORTD.5

    define LCD_DATA_PORT PORTB

    dim VSWR as word

    'AD Ref
    dir porta.2 in
    dir porta.3 in

    'Switches LH Side
    Dir Portc.0 in
    Dir PORTc.1 In

    'Control lines LH Side
    dir portc.2 out
    dir portc.3 out
    dir portd.0 out
    dir portd.1 out

    'Switches RH Side
    Dir PORTD.4 In

    'Control lines RH Side
    Dir portd.2 out
    dir portd.3 out
    dir portc.4 out
    dir portc.5 out
    dir porta.0 in
    dir porte.1 out
    dir porte.0 in

    '
    'Version 1.0 2015-07-12 (Shown when view Help/About)
    'GCGB v0.94 2015-11-23 (When compling)
    '
    cls
    locate 0,0
    print "18F45K80 10Dec15.a"
    locate 1,0
    print "Should be 10"
    Wait 1 S
    cls
    Main:
    VSWR = sqrt(100)
    locate 2,0
    print vswr

    wait 100 mS
    goto Main

     
  • Mikam

    Mikam - 2015-12-11

    Sorry. Just dawned on me always returns 2 decimal places.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.