CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

DS1990a Trouble

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Maximilius
Guest







DS1990a Trouble
PostPosted: Mon May 02, 2005 5:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon May 02, 2005 6:01 am     Reply with quote

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







PostPosted: Mon May 02, 2005 6:38 am     Reply with quote

Hi ckielstra,

Thanks for your quickly response Smile

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

View user's profile Send private message

PostPosted: Mon May 02, 2005 9:12 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon May 02, 2005 3:17 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group