i use RCM4120 in a embedded control application with many I/O functions, so i decide to use a RIO as IO-Expander, because of functionality.
The use of RIO was as first a little bit tricky because the many registers are accessed via pointer registers and Index registers.
On the Rabbit homepage, a driver-lib for RIO was promised, but i did not found it and a related email to the support was never answered.
So i started to write my own library in C 10.21 for the RIO.
My first impression: the game is quite slow! All functions programmed in
dynamic C 10.21 allows a shortest I/O-pulse of 61us (!) because there is need for some bit dangling, shifts, index pontings a.s.o. just to set an I/O in the RIO.
Inspecting the code produced shows that Dyn.C 10.21 produced horrible unoptimized code! A simple statement with a char variable like "n=+1" results in an addition of a 16-Bit register with 16-Bit constant of "1" (!?)
(i know, n++ would be better in this case,
So i wrote the whole RIO driver again in assembly and for the used address & data space, because RIO can only communicate via 1 Byte wide vars and access pins only in nibbles, so why should i process 16 Bit words?
After optimizing and testing the fastest I/O-update is about 6 uS, also not
very fast but a speed up factor of 10 compared to the C 10.21 version!
By the way, the documentation of RIO contains a bug. Docs of the quadrature decoders does not point out, that the setting of CLLR/CLMR registers must be programmed too for correct function.
Also, it is not pointed out, that the single pin settings collide with the nibble wide pin port settings, so the user cannot use both ways to set pins or group of pins of a port. (this is the reason why i decide to write a separate Pin set/reset/routine myself in the library)
My RIO lib is currently written for my own use and supports not all functions, but it is very straightforward and good understandable. It supports mainly the basic communication between Rabbit and RIO so expansion is quite forward.
BTW: in some of the Rabbit Libs reg IX is saved in the lib routines because of "costates", comments says. But i didn't found any description in the docs for that - is it necessary or not? My test prog with costates functions normally, even if i use IX in my lib.??
If anybody is interested, send mail