Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Time synchronization through UART

Status
Not open for further replies.

mufarish

Newbie level 4
Joined
Feb 11, 2006
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,327
uart synchronization

Hi,

I need help on my project at which I am working these days. I have to sychronize time (hh:mm:ss:msec) between computer and PIC controller through RS232. i.e. we have two clocks; one in computer & one in PIC(i have to implement it also). I have to synchronize time in both with the milli-second accuracy. I need suggestions or algorithms, how to implement it. I use PICC PCW CCS compiler & 18F448 or 16F877A controllers.
 

uart synchronization error

HI,
ITS VERY DIFFICULT TO SYNCHRONISE YOUR PC TIME USING SERIAL COMMUNICATION USING 16F877A.THINK U SHOULD BE USING 20MHZ CRYSTAL..ONE THING YOU CAN DO IS TO GENERATE YOUR ON TIME ON CONTROLLER..THEN PERODICALLY SYNC WITH PC.
 

uart communication in pic pcw

Hi,

I am using 20 MHz crystal. I want to know how to synchronize time; either I ping controller & get acknowledge and calculate delay b/w those messages & then send current time+delay to PIC to sync. Or I should try some other technique. I can use milliseconds to do this process.
 

time synchronization uart

Are you using a Real Time Clock? It's better to use one like ds1302.

I tried to synchronize the time from the pc to the microcontroller by sending time from the pc in hex format then updating the real time clock.

To implement high accuracy of synchronization adjust the time relevant to the delay caused by the processing.

I cannot help you with the program because I'm not familliar with c, although I can provide you additional info on how i did this.

:D
 

No I am not using RTC. I've implemented clock in PIC through timer & its ISR. Now I've to calculate delay time of sending new time from PC & its processing, so that both PC & PIC are synchronized. Provide me help on this.
 

hi,

u can generate real time with timers,after that at every pertical time interval
u take current time from pc and over write with u'r registers.

whish u all the best
 

Now I am facing problem of getting system time in milliseconds(even in micro seconds). How can I get that?
 

I think you are expecting too much here. The problen is that the PC is running a multitasking opperating system and will process your request when it gets around to it. If it is just doing one of it's system processes at the time you ask then many many milliseconds will pass and possible very much longer. One tenth of a second may even be a challenge.
Regards,
John.
 

I agree with u John. That's why I am just trying to synchronize time b/w two PICs through UART. Any suggestions on that?
 

Hi, Send the time from one PIC to the other PIC but add some 100ms to the time you send so that this time is always ahead of the time your at this moment. when the PIC receives this time it will update the clock but will keep the clock waiting before it is running again. Now you send a short START OF CLOCK message to PIC that is waiting and you start the clock !.

Even in windows you can sync but you have to use handshaking and send the time back and forth from PC-> PIC and PIC->PC and calculate the delay and send new time stamps with adjusted delay time until your error from send and read is smaller than your 1ms !. regards, Paul. PS: Many systems use this trick.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top