Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Controls Guy on February 23, 2022, 03:53:09 PM
-
I want to date stamp an event and I don't mind the timestamp being in the special DT register layout, but I can't find an expression that will take a DT as the source. MOVE and MEMCOPY both don't like it. I'd like to move to a range of MHR registers, so if I move the entire DT it will be 8 words, which is fine.
Is there an easier way than separate boxes MOVEing $Now.Year, $Now.Month, etc, one at a time?
-
MEMCOPY SDT0 to MHR100 w/Count of 1 Source
-
And the Memory Layout utility mentioned in the MEMCOPY editor shows you exactly how it will be layed out in your MHR WORD memory (on DWORD boundaries):
"Date/Time Struct" Structure Memory Layout (2 total DWORDs in length, DWORD Offset 0..1)
+------++----------------------------------------------------------------------------------------------------------------------------------++
| || Most Significant Least Significant ||
| ++----------------------------------------------------------------------------------------------------------------------------------++
| || DWORD ||
| ++----------------------------------------------------------------++----------------------------------------------------------------++
| || WORD 1 || WORD 0 ||
| ++-------------------------------++-------------------------------++-------------------------------++-------------------------------++
| || BYTE 3 || BYTE 2 || BYTE 1 || BYTE 0 ||
|DWORD ++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++
|Offset||b31|b30|b29|b28|b27|b26|b25|b24||b23|b22|b21|b20|b19|b18|b17|b16||b15|b14|b13|b12|b11|b10| b9| b8|| b7| b6| b5| b4| b3| b2| b1| b0||
+------++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---++
Note: Every Bit Field layout only shows the Field # (no name). See the list of Bit Field Names listed by Field # at the end.
+------++----------------------------------------------------------------++-------------------------------++-------------------------------++
| 0 || 2 .Year UWORD || 3 .Month UBYTE || 4 .Day UBYTE ||
| ||----------------------------------------------------------------++-------------------------------++-------------------------------++
| || 1 .Date SDWORD ||
+------++-------------------------------++-------------------------------++-------------------------------++-------------------------------++
| 1 || 6 .DayOfWeek UBYTE || 7 .Hour UBYTE || 8 .Minute UBYTE || 9 .Second UBYTE ||
| ||-------------------------------++-------------------------------++-------------------------------++-------------------------------++
| || 5 .Time SDWORD ||
+------++----------------------------------------------------------------------------------------------------------------------------------++
-
So
MHR100:UB0 will be the .Day
MHR100:UB1 will be the .Month
MHR101:U will be the .Year
MHR102:UB0 will be the .Second
MHR102:UB1 will be the .Minute
MHR103:UB0 will be the .Hour
MHR103:UB1 will be the .DayOfWeek
-
OH, I see what I was doing. It was telling me that the struct layout COULD be viewed in the UDT editor, and I read it as COULDN'T (plus the part about the UDT configurator was off the side of the dialog), so I thought it was objecting to the use of a DT type variable. I just needed to hit OK.
Sorry for the false alarm.
-
OH, I see what I was doing. It was telling me that the struct layout COULD be viewed in the UDT editor, and I read it as COULDN'T (plus the part about the UDT configurator was off the side of the dialog), so I thought it was objecting to the use of a DT type variable. I just needed to hit OK.
Sorry for the false alarm.
Yup - we stuck that "info" message in there to inform the user that they probably need to see the layout of their memory when doing a MEMCOPY of a structure to a raw memory block (or vice versa), rather than trying to figure it out by hand (not sure how they would know what the actual layout of a Designer structure would be without that tool).