mirror of
https://github.com/aster94/logic-analyzer.git
synced 2026-05-03 00:48:51 +03:00
Integration of all boards
Added a way to every board work with a single one processing code.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#define baudrate 115200 // check if it is the same in processing
|
||||
#define samples 200 // the number of samples you want to take
|
||||
|
||||
#define timezerooffset 125 //microsegundos
|
||||
#define F_CPU 16000000UL
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
@@ -19,6 +19,7 @@ volatile uint16_t timer1_overflow_count;
|
||||
uint8_t initial, state, old_state;
|
||||
uint8_t pinChanged[samples];
|
||||
uint32_t timer[samples];
|
||||
uint32_t timefix;
|
||||
uint16_t event = 0;
|
||||
|
||||
void init_board() {
|
||||
@@ -78,7 +79,10 @@ void start() {
|
||||
PORTC = (1 << 0);
|
||||
initial = PINB;
|
||||
state = initial;
|
||||
|
||||
for (int i=0; i < samples; i++) {
|
||||
pinChanged[i]=0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,15 +90,22 @@ void sendData() {
|
||||
PORTC = (0 << 0); //turn off led
|
||||
|
||||
//initial data
|
||||
Serial.println("S");
|
||||
Serial.print(initial); Serial.print(":");
|
||||
Serial.println(samples);
|
||||
|
||||
Serial.println("S");
|
||||
Serial.print(initial); Serial.print(','); Serial.print(B11111111); Serial.print(','); Serial.print(B11111111); Serial.print(":");
|
||||
Serial.println(samples+2);
|
||||
timefix = -timer[0]+timezerooffset;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
timer[i]=timer[i]+timefix;
|
||||
}
|
||||
Serial.print(B11111111);Serial.print(','); Serial.print(B11111111); Serial.print(','); Serial.print(B11111111); Serial.print(":");//Este segmento de codigo introduce un cambio en todos los
|
||||
Serial.println(0); //canales evita fallo visual.
|
||||
//data
|
||||
for (int i = 0; i < samples; i++) {
|
||||
Serial.print(pinChanged[i]); Serial.print(":");
|
||||
Serial.print(pinChanged[i]);Serial.print(','); Serial.print(B00000000); Serial.print(','); Serial.print(B00000000); Serial.print(":");
|
||||
Serial.println(timer[i]);
|
||||
}
|
||||
Serial.print(B11111111);Serial.print(','); Serial.print(B11111111); Serial.print(','); Serial.print(B11111111); Serial.print(":");
|
||||
Serial.println((timer[samples-1]+400));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user