Skip to content

Instantly share code, notes, and snippets.

@dj1711572002
Created September 12, 2020 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dj1711572002/98c6b42265c7674484ae5efbdeafce5b to your computer and use it in GitHub Desktop.
Save dj1711572002/98c6b42265c7674484ae5efbdeafce5b to your computer and use it in GitHub Desktop.
VB.NET MultiPortReceiving_ SycAccuracytest_slave cpu_NucleoF446ZE
//VB.NET MultiPort Receiving Test
//Nucleo F446ZE slave
#include "mbed.h"
Serial pc(USBTX,USBRX);
Timer t;
InterruptIn edge(PD_7);// L432KC timing input
InterruptIn Crst(PG_3);//Reset soignal for counter
int i=0;
int m=0;
int flag;
int t0,t0_1;
float rads,ds;
int ch1,ch2,ch3,ch4,ch5,ch6;
void flip()
{
m++;
flag=edge.read();
t0=t.read_ms();
pc.printf("COM8:%d,%d,%d,%d,%d,%d,%d,%d,%d\n\r",ch1,ch2,ch3,ch4,ch5,ch6,flag,t0-t0_1,m);
}
void flip1()
{
m=0;
t0_1=t.read_ms();
}
int main()
{
pc.baud(115200);
t.start();
edge.rise(&flip);
Crst.rise(&flip1);
while(1)
{
i++;
rads=(i*10%360)*0.01745286;
ds=400*sin(rads) ;
ch1=1000+ds;
ch2=2000+ds;
ch3=3000+ds;
ch4=4000+ds;
ch5=5000+ds;
ch6=6000+ds;
//pc.printf("%d,%3.3f,%3.3f,%d,%d,%d,%d,%d,%d,%d\n\r",i,rads,ds,ch1,ch2,ch3,ch4,ch5,ch6,t.read_ms());
//pc.printf("%4.3f,%4.3f,%d,%d,%d,%d,%d,%d,%d\n\r",rads,ds,ch1,ch2,ch3,ch4,ch5,ch6,t.read_ms());
//pc.printf("COM8:%d,%d,%d,%d,%d,%d,%d,\n\r",ch1,ch2,ch3,ch4,ch5,ch6,t.read_ms());
//wait_ms(100);//VB.NET 4msecOK
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment