Finally came around to testing the AR488-library on my Arduino Mega board connected to a stripped GPIB-cable.
It worked immediately in Controller Mode when communicating with my HP 34401A and also worked in Device Mode when my USB-GPIB-HS spoke to it via Python.
Im thrilled to see it working out of the box directly
Glad it worked!
In Device Mode the AR488 isnt capable of responding to a *IDN?-command with an answer, i assume?
Since its in device mode, it can't send GPIB commands to query another instrument. However, if you are thinking that as a device it might respond to *idn? from a controller just like an instrument does, then that functionality is not currently implemented but could be added. I will add it to the work log.
It would be nice to actually be able to use DipSwitches to set the address in Device Mode, so one wouldnt need to connect to the Arduino to change the address in software. Will that be integrated into the library in the future?
DIP switches require GPIO pins to detect their state and we don't have any spare on the smaller boards such as the Uno, Nano and Micro/Leonardo, but on the Mega that functionality could perhaps be added. I am also working on another development that might make it possible to implement DIP switches on the smaller boards as well. Another one for the work log.
I assume the Arduino is busy with the AR488-library and so i should use another µC to actually do my rather slow and amateur-programmer stuff like switching relays with its associated delays or is the library not bothered by it due to using interrupts for the time critical response stuff?
Obviously the more the microprocessor has to service the more processing cycles will be used which will impact on performance. I don't think switching a handful of GPIO pins and reading a response would be terribly onerous, particularly on a Mega 2560 which has better performance than a Nano, Uno or Micro Pro. Having said that, it is possible to link two Arduino boards via SPI, I2C or Serial and appropriate signalling could be implemented to have the second board respond to specific GPIB commands. That would allow one board to run the GPIB bus and the other to service the device hardware (relays etc) without one impacting much on the other.
Using interrupts on the Arduino does not seem as beneficial for controlling program flow as initially imagined. The interrupt service routine needs to be simple and fast, ie. set a variable which is then processed next time around the loop. The response is quicker in that the variable is set immediately the interrupt triggers, but one still has to wait for the next iteration of the loop before being able to process that variable and take the appropriate action. I am beginning to think that it would probably probably be easier and just as fast to check the state of the required pin as and when required during the process loop.
How do the LLO/LOC-commands coming from a controller influence the Device Mode actually? I can see the usage, but would expect that the Arduino in Device Mode activate two outputs for LEDs like "Front Panel Disabled" and "Remote Control Active" when seeing those commands?
Again, not currently implemented but could easily be done.
Sorry for the many questions, i just think that your library could enable many hobbyists to build instruments with GPIB-capability, apart from the usage as a very nice and low cost controller.
Is there a way to donate to you WaveyDipole? Couldnt find a way to do that on Github.
I am happy to answer any questions and thank you for the ideas.