How about this way?
Code:
' ==============================================================================
' One log record
voltage con 0 ' byte
amps CON voltage+1 ' word (amps is 1 byte away from voltage)
drive CON amps+2 ' word (drive is 2 bytes away from amps)
climit con drive+2 ' word
stat con climit+2 ' byte
szLog con stat+1
DataLog var byte[szLog] ' reserve the bytes for structure
This takes care of your struct size and also its member offsets - akin to doing it in assembler. This is similar to what you have suggested.
Bookmarks