OneWire timing in SX/B
Warren Brown
Posts: 2
First, let me say I'm new to the Sx and SX/B. But have been in programming (BASIC, Java, Z80 assembler, etc) for 20+ years.
I was just compiling and looking at the list code generated for the 1wire·BASIC project.· After playing with it a bit, not having ran it, just doing timing math, I am a bit confused.· It would appear that it generates the same delay timing loops whether TURBO is specified or not.· Now, if I specify a different FREQ, the loops change, but not for TURBO.
My question is whether:
a) is this a compiler bug?·· Shouldn't it adapt these timing loops?
b) should I never run in non-TURBO for best timing for 1wire apps?
c) does TURBO use more power?
d) am I simply miscalculating? I am assuming each DJNZ is 4 cycles at a 1/4_000_000 period, except the zero count, which is·only 2 cycles. The math falls apart for non-TURBO mode.
Thanks,
Warren
I was just compiling and looking at the list code generated for the 1wire·BASIC project.· After playing with it a bit, not having ran it, just doing timing math, I am a bit confused.· It would appear that it generates the same delay timing loops whether TURBO is specified or not.· Now, if I specify a different FREQ, the loops change, but not for TURBO.
My question is whether:
a) is this a compiler bug?·· Shouldn't it adapt these timing loops?
b) should I never run in non-TURBO for best timing for 1wire apps?
c) does TURBO use more power?
d) am I simply miscalculating? I am assuming each DJNZ is 4 cycles at a 1/4_000_000 period, except the zero count, which is·only 2 cycles. The math falls apart for non-TURBO mode.
Thanks,
Warren
Comments
SX/B is for TURBO use only.
There is nothing to be gained by NOT using turbo mode.
Turbo uses only very minimal power (much less than running the SX from 1/4 the frequency WITH turbo mode).
In other words the SX at 4MHz non-turbo uses much more power than a SX at 1MHz WITH turbo.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Ability may get you to the top, but it takes character to keep you there."
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Any reasons for not being a "big fan" of 1-wire?· My first exposure to them was with their Java iButton a few years ago.·It seemed·very reliable and the little cans of the ibuttons were darn near indestructable.·One of my pet projects now may be a weather station and they seem to have most of the sensitive parts available as ibuttons.·
Another question on the 1-wire bus, if you don't mind... Their documentation seems to be in conflict at times. Some places they say that "active pullup" is needed for longer runs ("exceeding table length", "about 3 feet"). Other docs say that simply using a smaller pullup resistor (no lower than 1k, no lower than "required" and· normal being 5k) is better than active pullup. Have you worked with different wire lengths and pullup values,·and have you experienced any problems?· I can see needing a 30 - 50' 1-wire bus, and will also be reading contents of their eeproms in blocks. Of course, the active pullup model would require me to rewrite all my own 1-wire routines to facilitate driving the pullup in parallel to the 1-wire bus.·
Am I correct that the SX28 1-wire bus (as shown in the Parallax manual)·is never sourcing current to the 1-wire, rather it simply pulls down the bus across the pullup, thus limiting it to sinking only the current coming through the pullup resistor?
Thanks everyone for the informative replies,
Warren
The pull-up resistor value depends alot on if the 1-wire device is using parasitic power.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Ability may get you to the top, but it takes character to keep you there."
·
We, too, have found conflicts in 1-Wire specs, hence I paid a visit to their labs to talk right to one of their support engineers.· We used the timing information he gave to me when creating the timing requirements for SX/B (I had originally coded it it with subroutines to·ensure that it works).· I'm having trouble locating my notes from the dialog with·Maxim/Dallas,·but when I do I will post them.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
In my code, I added compile time options to use·the TRIS functionality to do active pullups·on the 1-Wire port. This worked pretty well in my relatively small test setup, and required no extra parts· or pins.· Switching the port to output/high when needed gave the·net that extra·pullup·it needed for line powered devices.
One thing I've learned, from the long cable runs to·my 1-Wire Weather station, is that every 1-Wire net behaves differently.· You need to be careful with line impedence and capacitance, and adjust your pullup accordingly.
-AGM-