Atmel C one cycle

Apr 04, 2006 4 Replies

Hi,



I'm a bit struck at present as I am trying to make my data transfer over a clock cycle. I'm new to C in terms of using it on microcontrollers. my task is like -



__ __ __ __ __ __| |__| |__| |__| |__| |____ - clock ____ ____ ____ __| |___| |___| |_______- data



I am using a AT89C51ED2, I don't understand how to use the timers, and to achieve my goal I dont get whether I need to watch the overflow of both TH0 and TH1.



Can anyone show me an example because im very confused by this...



I don't really understand the setup of them and the values that are placed into the things like TMOD, SCON, TH1, TL1...



Thank you for your response



David



I feel your pain but you're looking for an explanation of 'way too much, all at once, as well as not really specifying the exact design requirements with respect to the data transfer.

Atmel has some good app notes on their web site. There is also a great deal of family-general information at

formatting link

Recommend before jumping right into pacing a data transfer that you start out with just using the timers to toggle an I/O pin until you get comfortable with manipulating the controlling registers.

Rich Webb Norfolk, VA

Hi, Just realised that my ascii image might be muddled up, so i've placed the image on a webpage -

formatting link

I want to use the atmel for the clock, and its not really fussy regarding time as the device only requires that the data be transfered in this means with a clock cycle of greater than 25ns.

thanks

David

Try using the SPI (page 64 of the datasheet). Much easier than bit twiddling.

Bob

Your processor at 40MHz is going to have a timer interval of at least 300nS so no worries on excessive speed there. If you are new to timers then I'd start off by making a couple of LEDs flash at a rate that you can see, then ramp it up.

Peter

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required