This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADUC timing loops,plz help

Hi there,
I have a development board around the aduc832BS processor and use Keil
uVision2 ver2.40 for software development.
I tried to implement the 1wire routines for DS18B20 (which i conected at
P3.4) but it seems that i have a timing problem.it all starts from the delay function.I use PLLCON=0x051(fcore=8.388608mhz)
below is an example of timing delay for DS5000 (8051 compatible) microcontroller with an 11.059MHz clock.
//Calling the routine takes about 24us,and
//then each count takes another 16us.

void delay(int useconds)
{
int s;
for (s=0; s<useconds;s++);
}
I also know that ADuC832 Machine Cycle Time is nominally 12/Core_CLK.
Could you tell me please how can i calculate the timings for the DELAY() (the Machine Cycles required for them) based on the aduc832. (ex. calling time for the delay() routine,calling time for each count in this routine).

For the DS5000 the reset routine is:
(Reset is 480us, so delay value is (480-24)/16 = 28.5 - we use 29.Presence checked another 70us later, so delay is (70-24)/16 = 2.875 - we use 3).
unsigned char ow_reset(void)
{
unsigned char presence;
DQ = 0; //pull DQ line low
delay(29); // leave it low for 480us
DQ = 1; // allow line to return high
delay(3); // wait for presence
presence = DQ; // get presence signal
delay(25); // wait for end of timeslot
return(presence); // presence signal returned } // 0=presence, 1 = no part

Thank you in advance for helping me out.

0