As this is the Arduino Forum I doubt you'll get much help with porting code.
If it was from another compiler to the Arduino platform you would get loads of help.
I have shown you some of the things that you can do with the AS1130 and will continue to write code for it until I get fed up or move on to another interesting project but you can't expect me or anyone else to try to help you with coding using a compiler/language/chip that has nothing to do with the Arduino. (not on this Forum anyway)
If I were you, I'd get an Arduino....problem solved.
Otherwise, I don't see that you can progress much further in this Forum and I'm not aware of any help forums for your compiler.
Still haven't managed to set the address pointer to the correct register using wire but 1 major issue is solved.
The Control register address words are not contiguous...they read from 0x00 to 0x0B skip 2 then start at 0x0E again. so reading 14 bytes does not read all the registers as in my code but only reads as far as the 2 unused registers 0x0C & 0x0D. This means the IRQ status is never read and hence the IRQ pin is never cleared!
Oh well...I'm always telling people to RTF datasheets......
At least now I can get on with the 24 x 22 matrix when the parts arrive from China.
The software shutdown is implemented by the LSb of the Shutdown open short register.
Hardware shutdown is implemented by the RSTN pin.
According to the datasheet all the RSTN lines are connected together for all chips.
Obviously, the Shutdown open short register is different for each chip...so you need to send 3 commands for 3 chips.
The decision you have to make is whether you want to seperately Hard reset each AS1130 or whether you want to do them all at once. In the first case you need 3 dedicated pins, in the second only 1.
Or
You can leave the RSTN pins clear of the MCU and just use a button (this is what I have done)
You can hard reset all the chips by connecting the RSTN lines together and pulling them to GND.
You can do this either with the MCU or a button (or both)
There is no way of soft resetting all the chips using one command.
Each chip has it's own Shutdown register and you have to clear the shdn bit in each chip seperately.
There might be a way of resetting them all with software but I haven't tried it and the datasheet is not clear about it but you can get all the chips to respond on the same address which may mean that one write to the Shutdown reg. will do them all. You'll have to try it to find out.
binarygod:
Answer/Question on your first paragraph:
see attachment!
so if I connect the switch like in the attachment, I can to a hardware reset with the uC AND with the switch if I understood well?
Correct!
Answer/Question on your second paragraph:
I think I missunderstood you! you meant with "to send 3 commands for 3 chips" that when I send data to the first driver I have to send first his adress and then all HIS registers (with his own Shutdown register) with THEIR specific bits, then when I send data to the second driver I have to send first his adress and then his registers (with his own Shutdown register) etc?
You don't HAVE to send all the data to each chip to reset it...you just need to write to the Shutdown register.
In the end I have three methods to reset them??? :
software with their own register, and hardware with a switch & with the uC?
I'll let you know about the IRQ when I have my 24x22 matrix finished, but you MUST clear the IRQ by reading the IRQ status register before you can use it AND after every interrupt generated.
I'm thinking that I'll use the MCU to do the timing...but I can't experiment until I've built the boards. 8)
That looks OK if you want to have a separate switch to reset the 1130s.
If you also want to reset them under program control you run the "separate Pin" wire to an output on the Arduino and pull that output LOW to reset the chips.
Please could you post here if you are interested in further developments with the AS1130 as I'm getting a bit frustrated with the Arduino method of development and debugging.
This is due to my lack of knowledge of the system, but I don't see any point in continuing with this if nobody is interested (I'll carry on but with a USB enabled PIC18F4550 happily on my own.)