Sending cnt in bytes
QuadrtrFlyr
Posts: 73
Hello folks,
Once again I have come back with a question and I would really appreciate your help!
I am trying to send the System Counter register (cnt) through a serial line in bytes to a device that needs some sort of time update. However cnt is 32 bits (long) and I need to split it up since I am sending 8bit packets (1 byte) at a time. I am not too good with bit shifting so could someone lend a helping a hand on how to split up this 32 bit long variable into 4 separate bytes?
Looking at the parallax propeller manual on page 219 it states that if I am using a 5MHz crystal than 50,000 cycles is about 10 ms (1/100th second) of time. So is it safe to assume that 1 cycle is equal to .2 microseconds? (1cycle*(10ms/50,000cycles)=.0002ms = .2 microseconds?
Thank you,
Robert
Once again I have come back with a question and I would really appreciate your help!
I am trying to send the System Counter register (cnt) through a serial line in bytes to a device that needs some sort of time update. However cnt is 32 bits (long) and I need to split it up since I am sending 8bit packets (1 byte) at a time. I am not too good with bit shifting so could someone lend a helping a hand on how to split up this 32 bit long variable into 4 separate bytes?
Looking at the parallax propeller manual on page 219 it states that if I am using a 5MHz crystal than 50,000 cycles is about 10 ms (1/100th second) of time. So is it safe to assume that 1 cycle is equal to .2 microseconds? (1cycle*(10ms/50,000cycles)=.0002ms = .2 microseconds?
Thank you,
Robert
Comments
Any ideas? I think I am shifting all the bits back into their correct location. The code reads the 1.0 (checked) but not the currenttime..
Is this correct:
Something like that: Usually only one byte for the checksum is used (the lowest byte of the sum). This has enough information to verify the correct transmission.
Andy