View previous topic :: View next topic |
Author |
Message |
Maximilius Guest
|
DS1990a Trouble |
Posted: Mon May 02, 2005 5:26 am |
|
|
Hello,
I've some trouble to read Dallas touch device (DS1990a).
This is my hardware config:
DQ on Pin_B5 tired to +5V via pullup resistor (4.7K)
�c = 18F458 @ 20MHz
I've tried first de EX_Touch.c example, but It's seem doesn't working for me!
I've also tried some snap code found on this forum but wihtout success.
How can I track some bug with 1-Wire protocole?
Any informations are welcome.
Regards,
Maximilius |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 02, 2005 6:01 am |
|
|
Many things can be wrong.
1) Which version of the CCS compiler are you using? V3.191 to v3.202 have a bug in delay_us() with values larger than 153 (two of these in touch.c).
2) PIN_B5 is also used for Low-voltage programming. Make sure you have the fuse NOLVP set in your program.
3) Have you checked your processor to be running fine? I always test with a simple program like blinking a led every second, this way you know the oscillator is running at the correct speed, etc. |
|
|
Maximilius Guest
|
|
Posted: Mon May 02, 2005 6:38 am |
|
|
Hi ckielstra,
Thanks for your quickly response
1) I use the V3.221 version of C Compiler.
2)I've checked the fuses and NOLVP is used.
3)I've tried a blinking led @ F=1Kz and accuracy is correct.
Any others suggests?
Regards,
Maximilius
P.S.: Here's my own delay_us function than I use:
#define DELAY_1US {#asm nop nop nop nop nop #endasm} // Delay = 1�s @ Fosc = 20MHz
void delayus(int16 timeus) {
while (timeus--) {
DELAY_1US;
}
} |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 02, 2005 9:12 am |
|
|
Quote: | P.S.: Here's my own delay_us function than I use:
#define DELAY_1US {#asm nop nop nop nop nop #endasm} // Delay = 1�s @ Fosc = 20MHz
void delayus(int16 timeus) {
while (timeus--) {
DELAY_1US;
}
} | Beware that your routine is an approximation! The 16-bit subtraction in the loop adds about 8 instructions and a branch, so you get about 200% timing error. The CCS routine is way more accurate. If you don't want to use the CCS routines, then search the web for some nice macro's.
I've no experience with the 1-wire protocol so can't help you with that. |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Mon May 02, 2005 3:17 pm |
|
|
Maximilius wrote: |
Any others suggests?
|
see
http://www.ccsinfo.com/forum/viewtopic.php?t=19520
note the helpful debugging messages which are sprinkled throughout my onewire library. uncomment them and define debug_putc to point someplace.
oh, and if you want help you are going to have to post your code (but please use the "CODE" button above to correctly format and indent the source).
jds-pic |
|
|
|