Hello,
i am a beginner in the microcontroller world. At the moment i want to use the SPI Library to communicate with a nother component.
The Spi library works very fine but in the next step i wanna toggle a LED on PIN d9 if the communications starts. My Problem is that thee pin D9 is to slow to turn the pin on a low level or High level. On the oscilooscope there you can see a small high-level peak but this peak isn't during the whole time of the data communication. In additional to that i don't wanna use any wait functions. there should be a better solution
WHat i want to do is :
Led on -> start with the communication -> Communication is over -> LeD off; > Later it should be in a loop.
here is my programm
<<code test>>
- include "mbed.h"
- include "FastPWM.h"
DigitalOut Enable(D9);
int f = 50000;
PwmOut Enable(D9);
SPI device(SPI_MOSI, SPI_MISO, SPI_SCK);
SPI device(D11, D12, D13);
int main() {
f=1000000;
Enable=1;
device.frequency(f);
device.format(16,1);
wait_us(20);
while(1) {
Enable = 0;
device.write(25);
Enable = 1;
}
}
<</code>>
Hello,
i am a beginner in the microcontroller world. At the moment i want to use the SPI Library to communicate with a nother component.
The Spi library works very fine but in the next step i wanna toggle a LED on PIN d9 if the communications starts. My Problem is that thee pin D9 is to slow to turn the pin on a low level or High level. On the oscilooscope there you can see a small high-level peak but this peak isn't during the whole time of the data communication. In additional to that i don't wanna use any wait functions. there should be a better solution
WHat i want to do is :
Led on -> start with the communication -> Communication is over -> LeD off;
> Later it should be in a loop.here is my programm
<<code test>>
DigitalOut Enable(D9); int f = 50000; PwmOut Enable(D9);
SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); SPI device(D11, D12, D13); int main() {
f=1000000;
Enable=1; device.frequency(f); device.format(16,1); wait_us(20);
while(1) { Enable = 0;
device.write(25);
Enable = 1;
} } <</code>>