|
|
View previous topic :: View next topic |
Author |
Message |
kda406
Joined: 17 Sep 2003 Posts: 97 Location: Atlanta, GA, USA
|
Serial Break? |
Posted: Tue Sep 30, 2003 11:59 am |
|
|
The Dallas DS2480 requires the Micro driving the serial port to issue a "break" under certain conditions (to start a session for example).
I have not been able to figure out how to issue a break using the CCS compiler. Can anybody tell me how to do this?
Thanks in advance.
-Kyle |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 30, 2003 12:48 pm |
|
|
Just set the transmit pin low for the duration of your break signal. Then communicate as usual.
If you would like to detect a break, then look for a framing error and verify the data is 0. |
|
|
kda406
Joined: 17 Sep 2003 Posts: 97 Location: Atlanta, GA, USA
|
|
Posted: Tue Oct 07, 2003 12:24 pm |
|
|
Mark,
Thanks for the advice. I finally got this to work. But for the archives I thought I should straighten something out.
As you stated it, the reciever will have a framing error because a start bit is a zero and so is the break. To make your suggestion work, there must be a high transition (back to the idle state) before the start bit.
This is the modified solution that I have found to work with several devices:
1) Set transmit pin low.
2) Delay for the duration of the break.
3) Set the transmit pin high.
4) Communicate as usual - the receiver will now see the start bit (zero) to start the first frame.
Without that high transition in step 3, the receiver gets very confused on the first byte.
Thanks very much for your help!
-Kyle |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Oct 07, 2003 12:45 pm |
|
|
Sorry that was not clear but yes that is the method. However, the framing error is generated when the STOP bit is low instead of high.
Regards,
Mark |
|
|
alikote
Joined: 02 Dec 2003 Posts: 1
|
ds2480:block of data and command bytes. |
Posted: Thu Dec 11, 2003 7:30 am |
|
|
kda406 wrote: | Mark,
Thanks for the advice. I finally got this to work. But for the archives I thought I should straighten something out.
As you stated it, the reciever will have a framing error because a start bit is a zero and so is the break. To make your suggestion work, there must be a high transition (back to the idle state) before the start bit.
This is the modified solution that I have found to work with several devices:
1) Set transmit pin low.
2) Delay for the duration of the break.
3) Set the transmit pin high.
4) Communicate as usual - the receiver will now see the start bit (zero) to start the first frame.
Without that high transition in step 3, the receiver gets very confused on the first byte.
Thanks very much for your help!
-Kyle |
Hi Kyle,
How many 1-wire devices have you connected to the DS2480? I am working on a project with 5 1-wire devices connected to the DS2480b. I was also confused by this "break" signal but now I can thank you because you fixed this point. The next one is the use of block of data and commands(for the devices connected to the 1-wire bus) to send to the ds2480b and read back the results into the pic 16f877. Have you tried it?
Can you share your knowledge with me? Many thanks to you and to every one who will answere.
Ali C. KOTE
Dakar
SENEGAL
Africa
|
|
|
Guest
|
|
Posted: Mon Jan 12, 2004 2:30 am |
|
|
Hi,
If this thread is still of interest I can fill in with my own use of it.
We currently have 50 sensors connected in-house for testing. At customers live installations we have up to some 100-150 sensors.
Works great!
Currently we only requests temp values as we pre-scan the unique ID of each sensor but will in 2 month complete with a ROM-search function and build a list of sensors in a flash memory to use for later readings.
I will, if time given, try to make a set of code that I can share as I saw others searching for DS2480 code on the list.
Cheers
Johan Fredriksson
JPF Consulting |
|
|
Guest
|
|
Posted: Tue Apr 06, 2004 5:43 am |
|
|
I really need help with the break.
This is my test code at the moment:
#include <16F877A.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,HS, NOPUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PC)
#use rs232(baud=9600,parity=N,xmit=PIN_C0,rcv=PIN_C1,bits=8,stream=ONEWIRE)
short int onewire_init_with_error_check()
{
// master_reset(); //
fputc(0xC1,ONEWIRE); //Send a reset in command mode
reset = fgetc(ONEWIRE); //Read the response byte
if((reset != 0xCD) || (reset != 0xED)) //If not right response
present = FALSE;
else
present = TRUE;
return present;
}
void main()
{
... (setting up)
fprintf(PC,"Test av onewire reset ");
output_low(PIN_C0);
delay_us(500);
output_high(PIN_C0);
test = onewire_init_with_error_check();
test += 48;
fputc(test,PC);
fprintf(PC,"\n\r");
fprintf(PC,"Reset variable = %X \n\r",reset);
while(TRUE)
{
}
}
The thing is that I cant generate the break/master reset pulse. The shortest pulse I measured was 150ms which is far to long.
Shouldn't I be able to set the TX pin low for the break (500us - 2ms?) and then set it high again? |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Sun Feb 26, 2006 1:00 am |
|
|
Mark wrote: | If you would like to detect a break, then look for a framing error and verify the data is 0. |
Do I have to poll the register to detect a break?
Can I detect a break in the ISR?
Would anyone be so kind to post the code for detecting a serial break?
Thanks,
Nick |
|
|
|
|
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
|