Arduino digital I/O

1 view (last 30 days)
David McQueen
David McQueen on 11 Dec 2019
Answered: Rohan Kale on 14 Feb 2020
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

Answers (1)

Rohan Kale
Rohan Kale on 14 Feb 2020
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®:

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!