longadd()
Description
This function is used to add 64-bit numbers.
Mathematical function which adds val with val2 (val+val2=res).
Syntax
longadd(valL, valH, val2L, val2H, resL, resH);
Parameters
Variable | Input |
|---|---|
| variable which holds least significant 32 bits of number you want to add with val2. |
| variable which holds most significant 32 bits of number you want to add with val2. |
| variable which holds least significant 32 bits of number you want to add with val. |
| variable which holds most significant 32 bits of number you want to add with val. |
| variable which will hold most significant 32 bits of addition result between val and val2. |
| variable which will hold least significant 32 bits of addition result between val and val2. |
Returns
Always returns SCRIPT_OPERATION_SUCCESS.
Function call example
Example of 64 bit addition
new Number1MSB = 3450;
new Number1LSB = 5310;
new Number2MSB = 6549;
new Number2LSB = 3578;
new ResultMSB = 0;
new ResultLSB = 0;
main()
{
longadd(Number1LSB, Number1MSB, Number2LSB, Number2MSB, ResultLSB, ResultMSB); // ResultMSB = 9999 and ResultLSB = 8888
for(;;)
{
Delay(1000);
}
}