Jeff Epler wrote: > On Tue, Feb 16, 2010 at 12:55:00AM -0800, Klemen Dovrtel wrote: > >> Would it be possible to make/compile hal modules for standard >> communication protocols like i2c, 1wire, uart,... For instance, I >> would like to connect a 1wire temperature sensor directly to parallel >> port for monitoring/control the temperature of machine/process. Has >> anybody tried this? >> > > It depends whether the protocol will work within the constraints of HAL. > Here, the timing constraints are probably most relevant: each > base-period you can sample an input once and change an output once. > Each period is displaced from its ideal time by up jitter, which in many > cases is nearly half as long as the period. > > If he is just interested in machine temperature, then it might work to do this one bit per servo cycle thing. But, I am guessing a one-wire temp sensor has a maximum clock period, as it has to run off internal capacitors when sending the temp data back. (There are other serial protocols that have a separate power pin, so this may not apply.) Some of these devices send relatively few bits of data and can do so as fast as a parallel port can go. So, I think a short routine that just runs for 30-50 us bit-banging the port pin could do it. HOWEVER, the Maxim part I think you have in mind is not like that, and it runs about 50 us per bit. And, it needs its parallel port bit to reverse direction once for every bit sent. The only parallel ports that can reverse direction are the 8 data lines, and they are all write, or all read. The Maxim DS18S20 has a "time slot" of 60 -120 us, per bit, so it can't be read at one bit per servo cycle. Maybe you could set up the BASE_THREAD time to satisfy this, but it sounds like a VERY wrong way to go. Yes, you might be able to make it work, but you'd be compromising so MUCH stuff in EMC just to get this one sensor working.
Jon ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users