The issue is that timing is critical. Now the CCS routines touch.c have a heavy reliance on delay_xx to conform to the timing of the 1 wire bus.
This is all well and good for a PIC dedicated to the 1 wire bus. I'm adding a Dallas temperature sensor 1820 type to a PIC pin. The PIC is also via isr linked to a CAN bus. I find I need to disable interrupts during the read of the 1820 to get the 1 wire timing working. Disabling interrupts in turn creates latency with incoming CAN bus traffic into a circular buffer.
Now I could just dedicate another PIC to the 1 wire bus letting it do the work of acquiring the temp and have a second PIC poll it for a 1 byte transfer.
The alternative would be a non blocking version of touch.c......has anyone looked into this.
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
Posted: Mon Aug 13, 2012 12:31 pm
I haven't done any Dallas One-Wire stuff in a long time (was one of my first PIC projects actually!).
You are correct - timing is critical. I remember playing with those aspects of the DOW bus protocol for fun.
you could do (and I've heard some talk about) doing something interrupt based which allows for a more non-blocking environment...
I've never implemented an ISR for collecting DOW data though..
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
Posted: Tue Aug 14, 2012 3:23 am
It is probably easier to use a I2C temp sensor on hardware I2C pins.
For the 1 wire non blocking interface to a 1820 temp sensor I was contemplating using the the PIC's rs232 hardware to develop the 1 wire pulses by both varying the baud rate and the char to send Ex 0xFF would get a long pulse at a slow baud rate. With the char representing the pulse in the Rs232 buffer the main code isn't blocked and with isr's on RDA and TBE and some state flags it might just work.
I was hoping someone had tried this before.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum