atmega328p hc-sr04

hi

haw to controll an hc-sr04 by one of the following atmel :

atmega328p and/or attiny2313 and/or at90s2313 ?

all the chip are 4mhz clocked by cerami resonator

so what is important haw to set correctly interrupt and timing parameter

thanks