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


Menu
Recent Articles


Using PDS with SPI GLCD based on ST7565R Controller
Graphic LCDs based on the ST7565 are cheaper then GLCDs with other controllers. SPI requires only four pins. If the circuit