Arduino digital I/O

3 次查看(过去 30 天)
David McQueen
David McQueen 2019-12-11
回答: Rohan Kale 2020-2-14
I am using an Arduino Mega 2560 to control a 5-bit parallel digital RF attenuator. At this time I am sending 1 bit at a time with 'writeDigitalPin', which is slow. Is there such a thing as 'writeDigitalWord' so I can write all 5 bits at once? Dave

回答(1 个)

Rohan Kale
Rohan Kale 2020-2-14
It is my understanding that you are trying to write an attenuation value by setting the 5-bits of the attenuator simultaneously. I also think that the timing of the control waveforms, i.e. the RF attenuation bits, may be critical as far as varying the RF power attenuation in realtime is concerned. However, there are no such methods/APIs as of R2019b under the MATLAB® Support Package for Arduino® hardware, which might provide a functionality to write the Arduino board's port pins simulatenously, i.e port write.
But I think you may consider a quick workaround using shiftregisters to write approproiate data to the RF attenuator, if it is not too much of a modificaiton to your hardware setup. Please refer to the documentation page on working with the shift register using MATLAB®:

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by