📄 sbpa1.c
字号:
/*************************************************************
Programme principal Ultrason
- Envoie SBPA sur CPLD -> pont -> Ultrason
Concepteurs : BECT Pierre & ROCHE Guillaume
Version 0.4
*************************************************************/
//Include fichiers Microchip
#include "p30f4011.h"
#include "timer.h"
#include "adc10.h"
#include "uart.h"
#include "stdio.h"
//Include fichiers du projet
#include "constantes.h"
#include "variables_globales.h"
#include "calcul_SBPA.h"
#include "initialisation.h"
//Prototype des fonctions
//Programme principal
int main(void)
{
char buf[32], w;
unsigned int temp;
unsigned int j;
//INITIALIATIONS
initialisation_port();
initialisation_UART();
//CALCUL DE LA SBPA
putsUART2("\r\n********************************************");
putsUART2("\r\n*** PROG SBPA ***");
putsUART2("\r\n********************************************");
// sprintf(buf,"\r\nCalcul SBPA en cours...\r\n");
// putsUART2(buf);
sprintf(buf,"ech=[");
putsUART2(buf);
for(w=0; w < 6 ; w++)
{
idx_adc_deb = w*NB_MAX_ECHANTILLONS;
idx_adc_fin = idx_adc_deb + NB_MAX_ECHANTILLONS - 1;
idx = 0;
idx_ech = 0;
fin_ech=0;
reg=0x555;
// sprintf(buf,"\r\n-- It閞ation : %d\r\n",w);
// putsUART2(buf);
initialisation_ADC();
// initialisation_timer();
// sprintf(buf,"Echantillonnage en cours ...\r\n");
// putsUART2(buf);
while(fin_ech==0);
// sprintf(buf,"Echantillonnage termine\r\n");
// putsUART2(buf);
DisableIntADC;
CloseADC10();
// DisableIntT1;
// CloseTimer1();
// sprintf(buf,"Timer & ADC desactives\r\n");
// putsUART2(buf);
//
// sprintf(buf,"Renvoie des info\r\n");
// putsUART2(buf);
for(j = 0 ; j < NB_MAX_ECHANTILLONS ; j++)
{
temp = echentillonnage[j];
echentillonnage[j]=0;
sprintf(buf,"\r\n%.1f ", (double)temp);
putsUART2(buf);
}
}
sprintf(buf,"];");
putsUART2(buf);
// sprintf(buf,"\r\nechantillons recupere : %.f\r\n",(double)w*NB_MAX_ECHANTILLONS);
// putsUART2(buf);
//BOUCLE INFINIE
while (1);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -