Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "uart.h"
- #include "adc.h"
- #include <util/delay.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define VT_HI 255
- #define VT_LO 0
- #define VT_M 128
- int main(void)
- { uint16_t bafarsaiz = 250;
- //uint32_t r = 0;
- //char buffer[30];
- uint8_t bufferCh0[bafarsaiz];
- uint8_t bufferCh1[bafarsaiz];
- uint8_t channel = 1;
- uint8_t pos_trg = 0;
- uart_init();
- init_adc();
- while (1)
- {/*
- r = calcVoltage(read_adc());
- itoa(r,buffer,10);
- uart_sendstr(buffer);
- uart_sendstr(" mV ");
- _delay_ms(1000);*/
- // PENTRU TRIGGER NEGATIV
- if(pos_trg == 0)
- {
- while(read_adc(channel)<VT_HI);
- while(read_adc(channel)>VT_LO);
- for(int i=0; i<bafarsaiz; i++)
- {
- bufferCh0[i]=read_adc(0);
- bufferCh1[i]=read_adc(1);
- }
- }
- //PENTRU TRIGGER POZITIV
- if(pos_trg == 1)
- {
- while(read_adc(channel)>VT_LO);
- while(read_adc(channel)<VT_HI);
- for(int i=0; i<bafarsaiz; i++)
- {
- bufferCh0[i]=read_adc(0);
- bufferCh1[i]=read_adc(1);
- }
- }
- UART_SendOscData(bufferCh0,bufferCh1,bafarsaiz);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement