Altera_Forum
Honored Contributor
21 years agoHelp with us delay routine in C
Hi...I am trying to create an i2c engine in Nios to read and write to an external seeprom. The problem I am having is developing an accurate micro second delay routine for the protocol. I know the nr_delay function is for milliseconds and I'm not even sure of the accuracy of that function. I'm still a little new to C programming. One quick and dirty approach is the use of nop commands in a loop, but I don't know if the asm nop command timing is based off of my 48MHz clock coming into the chip or some predefined time. Does anyone know? Can anyone suggest something to help?
Thanks.