• PicŪ Basic


  • Compiler workarounds

    PDS is an excellent compiler but like all complex software it is in a state of constant development. The purpose of this page is to help users develop more reliable programs where, due to a fix in progress, or due to a difference in languages some forewarning can be helpful.

    Comments should apply to the latest full release version only, and not pre-release or Beta versions.

    The HELP file describes the format for trig functions as "Function Variable", notice there are no brackets. Using this structure in complex expressions may give an unexpected result
    .

    Be aware that "sin a + 1" is not the same as "sin (a) + 1". The "sin a+1" is instead translated as "sin (a+1)". Because the compiler also accepts "Function (Variable)" for sin, cos, etc. I suggest you use the bracketed form "Function (variable)" to overcome this.

    Want to turn off rounding when assigning a float to an integer ?

    This is very handy when wanting either a non rounded integer or to extract a fractional part of a float

    When a float is assigned to an integer, PDS automatically rounds the result. For example:

    Code:
    Integervalue as Word 
    Floatvalue as Float 
    Floatvalue = 2.59 
    Integervalue = Floatvalue       'assign the float value to an integer
    'Integervalue now has a value of 3
    Now, if you want a non rounded assignment Access _FP_FLAGS like this:

    Code:
    Integervalue as Word 
    Floatvalue as Float 
    Floatvalue = 2.59 
    _FP_FLAGS = 0                'disable Rounding 
    Integervalue = floatvalue  'do the assignment and any other things you need to do 
    _FP_FLAGS = 64            ' re-enable Rounding
    'Integervalue now has a value of 2

    contributed by John Drew.
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 22:50 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post