## page was renamed from AdcmRawdataFormat
= ADCM Data Format =
<<TableOfContents>>
== Stream Structure ==
The file contains packets of data with header and payload. Header specifies the type of data block and packet size.
== Packet Header ==
||offset||size, bytes||type||name||description||
||0||2||int||ID||block type||
||2||2||int||size||packet size, bytes, including header||
||4||''size-4''||struct||data||data block, contents defined by type||

== Data Blocks ==

=== ID 0x504D, CMAP ===
||offset||size, bytes||type||name||description||
||0||4||int||N||number of map entries||
||4||1||int||map1||map for channel 1||
||5||1||int||map2||map for channel 2||
||<:-5>...||
||*||1||int||mapN||map for channel N||

map bits:
||bit||description||
||0||reserved||
||1||channel type is Master, γ||
||2||channel type is Slave, α||
||3||baseline calibration enabled||
||7:4||reserved||


=== ID 0x5645, EVNT ===
||offset||size, bytes||type||name||description||
||0||1||int||N||number of entries||
||1||1||int||-||reserved||
||2||2||int||-||reserved||
||4||4||int||ts||event time-stamp||
||8||14||struct||pulse1||pulse data block 1||
||<:-5>...||
||*||14||struct||pulseN||pulse data block N||

pulse data block structure:

||offset||size, bytes||type||name||description||
||0||1||int||ch||channel number||
||1||1||int||flags||flags||
||2||4||float||a||pulse amplitude (integral), baseline subtracted||
||6||4||float||t||pulse time||
||10||4||float||w||pulse width||

flags:
||bit||description||
||0||reserved||
||1||channel type is Master, γ||
||2||channel type is Slave, α||
||3||baseline calibration enabled||
||7:4||reserved||

=== ID 0x5443, CNTR ===
||offset||size, bytes||type||name||description||
||0||4||int||N||number of entries||
||4||8||double||time||measurement period||
||12||4||int||cnt1||input pulse count for channel 1||
||<:-5>...||
||*||4||int||cntN||input pulse count for channel N||

== Decoder Example ==
=== adcm_16.h ===
{{attachment:adcm_16.h}}
=== adcm_df.h ===
{{attachment:adcm_df.h}}
=== df_decode.c ===
{{attachment:df_decode.c}}

----
[[CategoryAdcm|ADCM]] [[CategoryRawData|RawData]]