C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 Datenbogen

Produktcode
198805
Seite von 42
DO   
MILLIVOLT=98*ADC8/5                   
VOLT=MILLIVOLT/1000 
NACHKOMMA=MILLIVOLT MOD 1000 
LCD.POS 1,1 
LCD.PRINT "ADC8: "& VOLT & "." 
if NACHKOMMA<100 then LCD.PRINT "0" 
LCD.PRINT NACHKOMMA & " V     " 
LOOP 
DO  
VOLTS=FLOAT(ADC8)*0.0196 
LCD.POS 1,1 
LCD.PRINT VOLTS & "V        " 
LOOP 
 
 
 
 
 
 
 
 
 
 
 
 
Samples of some complexTerms 
 
MyFloat=MyFloat/FLOAT(ADC8*MyByte)*0.0196+MyFloat*MyFloat   
MyFloat= FLOAT(MyWord-MyByte*MyWord)/(MyFloat+MyFloat/5) 
 
 
 
 
SIN, COS 
Accuracy 
The Sinus is calculated with a Taylor Function and is considered to be a very good approximation. The the 
calculated values for angles 0 to 90 degrees have more than 5 digit accuracy. But beyond this accuracy 
drops to 3 digits at 130° and 2 digits at 179°. The accuracy can be improofed if  the term x^11/11! and 
beyond terms are added. 
 
Domain 
The calculation is limited to angels  from -180° to +180°. Angles beyond this range have to be mapped to this 
range. This is also valid vor COS because it is calculated by the equation COS(x)=1-SIN(x).   
 
SIN can not calculate a term. a constant angle or a variable containig an angle is required therefore 
BPPDEGREES is the input in degrees, BPPRADIANS is input as radians ( -3.14.......+3.14).  
 
MyFloat=SIN(ANGLE,bppdegrees) 
MyFloat=SIN(30.33,bppdegrees) 
 
 
 
 
 
MyFloat=COS(ANGLE,bppdegrees) 
MyFloat=COS(30.33,bppdegrees) 
 
 
 
SQRT 
accuracy 
The Sqare Root calculation is done also by an approxipation with an accuracy of better than 5 digits. SQRT 
can not calculate a term. A single constant or variable is required for calculation. 
 
 
 
 
 
37
MyFloat=SQRT(VALUE) 
MyFloat=SQRT(12.345)