Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- JovanEps
- Date:
- 2017-01-04
- Revision:
- 7:13ae8d34cc97
- Parent:
- 6:64a3bea8be86
- Child:
- 8:3af851c7bb8d
File content as of revision 7:13ae8d34cc97:
#include "mbed.h"
//********************************************************
//** Nucleo-144 Stm32F746 and Stm32F767 bitbanging ******
//** Port setting and pattern generation ******
//** Speed - Benchmark ******
//** Jovan Ivković - 2016. ******
//** JovanEps (jovan.eps@gmail.com). ******
//********************************************************
DigitalOut myled(LED1);
DigitalOut PD7(PF_13);
DigitalOut PD5(PE_11); //introduce D5 pin-out it ping faster :)
DigitalOut PD13(PA_5); //introduce D13 pin-out
Serial pc(USBTX, USBRX);
Timer timer;
void Pinging()
{
int vreme = 0;
while(1) {
// Pattern and port setting speed benchmark
timer.start();
vreme = timer.read_us();
for(int ii=0, ii<99, ii+) {
PD5 = 1; // D5 go low 1 go LOW in next 74..75ns
PD5 = 1; // D5 go low 2
PD5 = 1; // D5 go low 3
PD5 = 0; // D5 go inv-high on SN74vhc14 - >1.6..2.4V < 1.75ns
PD5 = 1; // D5 go low 5
PD5 = 1; // D5 go low 6
PD5 = 1; // D5 go low 7
PD5 = 1; // D5 go low 8
PD5 = 1; // D5 go low 9
PD5 = 1; // D5 go low 10
}
vreme = timer.read_us() - vreme;
wait_us(0.2);
pc.printf("Circle time... %4.4f \n", ( float ) vreme / 1000 ); //1k sets of PD5
pc.printf("\n\n");
timer.stop();
/* // Alternative
while(1) {
PD5 = 0; // D5 go low 1
PD5 = 0; // D5 go low 2
PD5 = 0; // D5 go low 3
PD5 = 1; // D5 go inv-low on 74vhc14 - <0.6v..0.9V < 1.6ns
PD5 = 0; // D5 go low 5
PD5 = 0; // D5 go low 6
PD5 = 0; // D5 go low 7
PD5 = 0; // D5 go low 8
PD5 = 0; // D5 go low 9
PD5 = 0; // D5 go low 10
wait_us(0.3);
*/
//pc.printf("\n");
}
}
int main()
{
myled = 1; // LED is ON - working
pc.baud(115200);
//pc.baud(921600); // Max garanted UART/seriall speed
pc.printf("Starting...\n");
wait(0.2); // 200 ms
//NVIC_DisableIRQ(XXX); // Disable NVIC interrupt;
Pinging(); //Call of Pinging methode
/*
while(1) {
// PD7 = 1; // D7 go high in ~75ns
//PD13 = 1; // D13 go high has delay of
// myled = 1;
PD5 = 0; // D5 go high
//wait(0); // 1ns - exclude, we need as fast as we can get
// PD7 = 0; // D7 go low in next 74ns
//PD13 = 0; // D13 go high
// PD7 = 1;
//PD13 = 1; // D13 go high
PD5 = 0;
// PD13 = 0; // D13 go high
//myled = 0;
PD5 = 0; // D5 go low
PD5 = 1; // D5 go inv-high on 74vhc14 - 1v
PD5 = 0; // D5 go low
PD5 = 1; // D5 go inv-high on 74vhc14 -2v
PD5 = 0; // D5 go low 2v
PD5 = 1; // D5 go inv-high on 74vhc14 - 2v
PD5 = 0; // D5 go low 2v
PD5 = 1; // D5 go inv-high on 74vhc14 - 3v
PD5 = 0; // D5 go low 3v
//v4 111010101010101 4-low lead and 6-inv-peek
PD5 = 1; // D5 go inv-high on 74vhc14 - 4v
PD5 = 0; // D5 go low 4v
PD5 = 1; // D5 go inv-high on 74vhc14 - 4v
PD5 = 0; // D5 go low 4v
//wait(0);// 1nsec - exclude, we need as fast as we can get
}
*/
}