started voltmeter hacking

This commit is contained in:
Eddy
2015-01-31 21:19:39 +03:00
parent e31148c97d
commit 48a3b5a31e
43 changed files with 3382 additions and 3331 deletions

6
voltmeters/calc/U.m Normal file
View File

@@ -0,0 +1,6 @@
function u = U(ADU)
adu = uint32(ADU)
adu *= 3584
adu = bitshift(adu, -17);
u = uint32(10*adu);
endfunction

BIN
voltmeters/calc/u5 Executable file

Binary file not shown.

20
voltmeters/calc/u5.c Normal file
View File

@@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdint.h>
uint32_t U(uint32_t x){
x *= 3584;
x >>= 17;
return x*10;
}
int main(int argc, char **argv){
uint32_t x = 131072;
int i;
if(argc > 1){
for(i = 1; i < argc; i++){
x = atoi(argv[i]);
printf("U(%u) = %u\n", x, U(x));
}
}else printf("U(%u) = %u\n", x, U(x));
return 0;
}