realtime or not?!

The arduino is real time I suspect that it is simulink that is not real time.

read the digital data with for example frequency of 500hz

That depends on how quick you can transfer data from the Arduino into simulink.

If you want any help with code then you have to post it.