Shop OBEX P1 Docs P2 Docs Learn Events
TimeStamp Display on FullDepluxSerial — Parallax Forums

TimeStamp Display on FullDepluxSerial

Andy_ouhscAndy_ouhsc Posts: 17
edited 2011-06-27 11:53 in Propeller 1
I am trying to get a time stamp from the timestamp object and display it through FullDepluxSerial

I did something like this:
OBJ:
Time: "Timestamp"
Serial: "FullDuplexSerial

I know that "time.start(0,0,0)" starts the clock at 0 minutes, 0 seconds and 0 milliseconds.
I know that in order to call for the time, I do something like this:
time.gettime(@minutes)

Here are my questions:
1. I think @minutes contains (minutes,seconds,milliseconds), it contains 3 values at once. Is that correct?
2. If I was correct with the above assumption, how would I display the values of minutes, seconds and milliseconds on the FullDuplexSerial? Something like "2 15 123"??? What would be the correct code?
I tried "serial.dec(@minutes)",but it did not work for me. My understanding it is calling the address and displaying the integers????

Any suggestions? What did I do wrong and how would I fix it?


Timestamp.spinFullDuplexSerial.spin


I have attached the timestamp and fulldepluxserial SPIN files.
Thank you


-Andy

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-06-27 09:41
    "time.gettime(address)" is given the address of a 3 element long array whose 3 elements get set to the minutes, seconds, and milliseconds values of the current time. You can use "serial.dec(value)" on each of these values like this:
    VAR long theTime[ 3 ]
    '-------
    time.gettime(@theTime) ' get the time
    serial.dec(theTime[ 0 ]) ' output minutes
    serial.tx(":")
    serial.dec(theTime[ 1 ]) ' output seconds
    serial.tx(".")
    serial.tx(theTime[ 2 ] / 100 + "0") ' output hundreds of milliseconds
    serial.tx(theTime[ 2 ] / 10 // 10 + "0") ' output tens of milliseconds
    serial.tx(theTime[ 2 ] // 10 + "0") ' output milliseconds units
    ' The above is needed because .DEC suppresses leading zeroes.
    
  • Andy_ouhscAndy_ouhsc Posts: 17
    edited 2011-06-27 09:47
    I will take a look at this.
    Thank you for the quick reply Mike.
  • Andy_ouhscAndy_ouhsc Posts: 17
    edited 2011-06-27 10:30
    Solved. Thank you very much!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-06-27 10:36
    Andy,

    Since your problem is solved, you should edit your original post. You'll need to "Go Advanced" and then you should have access to the little pull-down widow with "Solved" and "Unsolved".

    Leaving the thread "Unsolved" makes it look like you didn't get the help you wanted (at least it looks that way to me).

    BTW, Welcome to the forums.

    Duane
  • Andy_ouhscAndy_ouhsc Posts: 17
    edited 2011-06-27 11:53
    ah, thanks for letting me know.
Sign In or Register to comment.