Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
karudu
/
Scope
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
17d365e7
authored
Oct 28, 2022
by
karudu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Väiksed parandused
parent
837bf1e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
56 deletions
adc_vtable.ino
gen_table/gen_table.c
scope.ino
adc_vtable.ino
View file @
17d365e7
This diff is collapsed.
Click to expand it.
gen_table/gen_table.c
0 → 100644
View file @
17d365e7
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
File
=
fopen
(
"adc_vtable.ino"
,
"w"
);
printf
(
"Enter max voltage
\n
"
);
double
Max
;
scanf
(
"%lf"
,
&
Max
);
fprintf
(
File
,
"const char FLASH_VoltageTable[1024 * 3] PROGMEM =
\n
"
);
fprintf
(
File
,
"{
\n
"
);
for
(
int
i
=
0
;
i
<
1024
;
i
++
)
{
char
Buf
[
16
];
sprintf
(
Buf
,
"%.02f"
,
((
double
)
i
/
1023
.
0
)
*
Max
);
fprintf
(
File
,
"
\t
'%c', '%c', '%c',
\n
"
,
Buf
[
0
],
Buf
[
2
],
Buf
[
3
]);
}
fprintf
(
File
,
"};
\n
"
);
return
0
;
}
\ No newline at end of file
scope.ino
View file @
17d365e7
...
@@ -65,7 +65,7 @@ void Error()
...
@@ -65,7 +65,7 @@ void Error()
void
InitADC
()
void
InitADC
()
{
{
ADCSRA
=
bit
(
ADEN
)
|
bit
(
ADIE
)
|
bit
(
ADIF
);
// Enable the ADC and the read complete interrupt
ADCSRA
=
bit
(
ADEN
)
|
bit
(
ADIE
)
|
bit
(
ADIF
);
// Enable the ADC and the read complete interrupt
ADCSRA
|=
bit
(
ADPS2
)
;
// Prescaler 16
ADCSRA
|=
bit
(
ADPS2
)
|
bit
(
ADPS1
);
// Prescaler 64
ADMUX
=
bit
(
REFS0
)
|
PIN_ADC
;
ADMUX
=
bit
(
REFS0
)
|
PIN_ADC
;
ADCSRB
=
bit
(
ADTS0
)
|
bit
(
ADTS2
);
// Timer 1 CompareB
ADCSRB
=
bit
(
ADTS0
)
|
bit
(
ADTS2
);
// Timer 1 CompareB
ADCSRA
|=
bit
(
ADATE
);
// Enable auto trigger
ADCSRA
|=
bit
(
ADATE
);
// Enable auto trigger
...
@@ -124,9 +124,13 @@ void SetTimerPeriod(int Period)
...
@@ -124,9 +124,13 @@ void SetTimerPeriod(int Period)
sei
();
sei
();
}
}
unsigned
long
AdcT
=
0
;
// ADC complete ISR
// ADC complete ISR
ISR
(
ADC_vect
)
ISR
(
ADC_vect
)
{
{
/*Serial.println(micros() - AdcT);
AdcT = micros();*/
//unsigned long tstart = micros();
//unsigned long tstart = micros();
//Serial.println((ADC / 1023.0) * 4.8);
//Serial.println((ADC / 1023.0) * 4.8);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment