- Datasheets
- Accessories
- CB15
- CB25
- CB37 V1.2
- CB37 V2.1
- EB37
- EI-1022
- EI-1034
- EI-1040
- EI-1050
- IDCA-10
- LJTick-CurrentShunt
- LJTick-DAC
- LJTick-DAC Testing Utility
- LJTick-DigitalOut5V
- LJTick-Divider
- LJTick-InAmp
- LJTick-InBuff
- LJTick-LVDigitalIO
- LJTick-OutBuff
- LJTick-Proto
- LJTick-RelayDriver
- LJTick-Resistance
- LJTick-VRef
- Mux80 AIN Expansion Board
- PS12DC
- RB12
- RB16
- T-Series Datasheet
- Preface: Warranty, Liability, Compliance
- 1.0 Device Overview
- 2.0 Installation
- 3.0 Communication
- 4.0 Hardware Overview
- 5.0 USB
- 6.0 Ethernet
- 7.0 WiFi (T7-Pro only)
- 8.0 LEDs
- 9.0 VS, Power Supply
- 10.0 SGND and GND
- 11.0 SPC
- 12.0 200uA and 10uA (T7 Only)
- 13.0 Digital I/O
- 13.1 Flexible I/O (T4 Only)
- 13.2 DIO Extended Features
- 13.2.1 EF Clock Source
- 13.2.2 PWM Out
- 13.2.3 PWM Out with Phase
- 13.2.4 Pulse Out
- 13.2.5 Frequency In
- 13.2.6 Pulse Width In
- 13.2.7 Line-to-Line In
- 13.2.8 High-Speed Counter
- 13.2.9 Interrupt Counter
- 13.2.10 Interrupt Counter with Debounce
- 13.2.11 Quadrature In
- 13.2.12 Interrupt Frequency In
- 13.2.13 Conditional Reset
- 13.3 I2C
- 13.4 SPI
- 13.5 SBUS
- 13.6 1-Wire
- 13.7 Asynchronous Serial
- 14.0 Analog Inputs
- 15.0 DAC
- 16.0 DB37 (T7 Only)
- 17.0 DB15
- 18.0 Internal Temp Sensor
- 19.0 RTC (T7 Only)
- 20.0 Internal Flash
- 21.0 SD Card (T7 Only)
- 22.0 OEM Versions
- 23.0 Watchdog
- 24.0 IO Config, _DEFAULT
- 25.0 Lua Scripting
- Appendix A - Specifications
- Appendix B - Drawings and CAD Models
- Appendix C - Firmware Revision History
- Appendix D - Packaging Information
- Appendix E - Software Options
- U3 Datasheet
- Preface
- 1 - Installation
- 2 - Hardware Description
- 2.1 - USB
- 2.2 - Status LED
- 2.3 - GND and SGND
- 2.4 - VS
- 2.5 - Flexible I/O (FIO/EIO)
- 2.6 - AIN
- 2.6.1 - Channel Numbers
- 2.6.2 - Converting Binary Readings to Voltages
- 2.6.3 - Typical Analog Input Connections
- 2.6.3.1 - Signal from the LabJack
- 2.6.3.2 - Unpowered Isolated Signal
- 2.6.3.3 - Signal Powered By the LabJack
- 2.6.3.4 - Signal Powered Externally
- 2.6.3.5 - Amplifying Small Signal Voltages
- 2.6.3.6 - Signal Voltages Beyond 0-2.44 Volts (and Resistance Measurement)
- 2.6.3.7 - Measuring Current (Including 4-20 mA) with a Resistive Shunt
- 2.6.3.8 - Floating/Unconnected Inputs
- 2.6.3.9 - Signal Voltages Near Ground
- 2.6.4 - Internal Temperature Sensor
- 2.7 - DAC
- 2.8 - Digital I/O
- 2.9 - Timers/Counters
- 2.9.1 - Timer Mode Descriptions
- 2.9.1.1 - PWM Output (16-Bit, Mode 0)
- 2.9.1.2 - PWM Output (8-Bit, Mode 1)
- 2.9.1.3 - Period Measurement (32-Bit, Modes 2 & 3)
- 2.9.1.4 - Duty Cycle Measurement (Mode 4)
- 2.9.1.5 - Firmware Counter Input (Mode 5)
- 2.9.1.6 - Firmware Counter Input With Debounce (Mode 6)
- 2.9.1.7 - Frequency Output (Mode 7)
- 2.9.1.8 - Quadrature Input (Mode 8)
- 2.9.1.9 - Timer Stop Input (Mode 9)
- 2.9.1.10 - System Timer Low/High Read (Modes 10 & 11)
- 2.9.1.11 - Period Measurement (16-Bit, Modes 12 & 13)
- 2.9.1.12 - Line-to-Line Measurement (Mode 14)
- 2.9.2 - Timer Operation/Performance Notes
- 2.9.1 - Timer Mode Descriptions
- 2.10 - SPC (… and SCL/SDA/SCA)
- 2.11 - DB15
- 2.12 - U3-OEM
- 2.13 - Hardware Revision Notes
- 3 - Operation
- 4 - LabJackUD High-Level Driver
- 4.1 - Overview
- 4.2 - Function Reference
- 4.2.1 - ListAll()
- 4.2.2 - OpenLabJack()
- 4.2.3 - eGet() and ePut()
- 4.2.4 - eAddGoGet()
- 4.2.5 - AddRequest()
- 4.2.6 - Go()
- 4.2.7 - GoOne()
- 4.2.8 - GetResult()
- 4.2.9 - GetFirstResult() and GetNextResult()
- 4.2.10 - DoubleToStringAddress()
- 4.2.11 - StringToDoubleAddress()
- 4.2.12 - StringToConstant()
- 4.2.13 - ErrorToString()
- 4.2.14 - GetDriverVersion()
- 4.2.15 - TCVoltsToTemp()
- 4.2.16 - ResetLabJack()
- 4.2.17 - eAIN()
- 4.2.18 - eDAC()
- 4.2.19 - eDI()
- 4.2.20 - eDO()
- 4.2.21 - eTCConfig()
- 4.2.22 - eTCValues()
- 4.3 - Example Pseudocode
- 4.3.1 - Open
- 4.3.2 - Configuration
- 4.3.3 - Analog Inputs
- 4.3.4 - Analog Outputs
- 4.3.5 - Digital I/O
- 4.3.6 - Timers & Counters
- 4.3.7 - Stream Mode
- 4.3.8 - Raw Output/Input
- 4.3.9 - Easy Functions
- 4.3.10 - SPI Serial Communication
- 4.3.11 - I²C Serial Communication
- 4.3.12 - Asynchronous Serial Communication
- 4.3.13 - Watchdog Timer
- 4.3.14 - Miscellaneous
- 4.4 - Errorcodes
- 5 - Low-level Function Reference
- 5.1 - General Protocol
- 5.2 - Low-Level Functions
- 5.2.1 - Bad Checksum
- 5.2.2 - ConfigU3
- 5.2.3 - ConfigIO
- 5.2.4 - ConfigTimerClock
- 5.2.5 - Feedback
- 5.2.5.1 - AIN: IOType = 1
- 5.2.5.2 - WaitShort: IOType=5
- 5.2.5.3 - WaitLong: IOType=6
- 5.2.5.4 - LED: IOType=9
- 5.2.5.5 - BitStateRead: IOType=10
- 5.2.5.6 - BitStateWrite: IOType=11
- 5.2.5.7 - BitDirRead: IOType=12
- 5.2.5.8 - BitDirWrite: IOType=13
- 5.2.5.9 - PortStateRead: IOType=26
- 5.2.5.10 - PortStateWrite: IOType=27
- 5.2.5.11 - PortDirRead: IOType=28
- 5.2.5.12 - PortDirWrite: IOType=29
- 5.2.5.13 - DAC# (8-bit): IOType=34,35
- 5.2.5.14 - DAC# (16-bit): IOType=38,39
- 5.2.5.15 - Timer#: IOType=42,44
- 5.2.5.16 - Timer#Config: IOType=43,45
- 5.2.5.17 - Counter#: IOType=54,55
- 5.2.5.18 - Buzzer: IOType=63
- 5.2.6 - ReadMem (ReadCal)
- 5.2.7 - WriteMem (WriteCal)
- 5.2.8 - EraseMem (EraseCal)
- 5.2.9 - Reset
- 5.2.10 - StreamConfig
- 5.2.11 - StreamStart
- 5.2.12 - StreamData
- 5.2.13 - StreamStop
- 5.2.14 - Watchdog
- 5.2.15 - SPI
- 5.2.16 - AsynchConfig
- 5.2.17 - AsynchTX
- 5.2.18 - AsynchRX
- 5.2.19 - I²C
- 5.2.20 - SHT1X
- 5.2.21 - SetDefaults (SetToFactoryDefaults)
- 5.2.22 - ReadDefaults (ReadCurrent)
- 5.2.23 - 1-Wire
- 5.3 - Errorcodes
- 5.4 - Calibration Constants
- Appendix A - Specifications
- Appendix B - Enclosure and PCB Drawings
- U3 Firmware Revision History
- U6 Datasheet
- Preface: Warranty, Liability, Compliance
- 1 - Installation
- 2 - Hardware Description
- 2.1 - USB
- 2.2 - Power and Status LED
- 2.3 - GND and SGND
- 2.4 - VS
- 2.5 - 10UA and 200UA
- 2.6 - AIN
- 2.6.1 - Channel Numbers
- 2.6.2 - Converting Binary Readings to Voltages
- 2.6.3 - Typical Analog Input Connections
- 2.6.3.1 - Signal from the LabJack
- 2.6.3.2 - Unpowered Isolated Signal
- 2.6.3.3 - Signal Powered By the LabJack
- 2.6.3.4 - Signal Powered Externally
- 2.6.3.5 - Amplifying Small Signal Voltages
- 2.6.3.6 - Signal Voltages Beyond ±10 Volts (and Resistance Measurement)
- 2.6.3.7 - Measuring Current (Including 4-20 mA) with a Resistive Shunt
- 2.6.3.8 - Floating/Unconnected Inputs
- 2.6.4 - Internal Temperature Sensor
- 2.6.5 - Signal Range
- 2.7 - DAC
- 2.8 - Digital I/O
- 2.9 - Timers/Counters
- 2.9.1 - Timer Mode Descriptions
- 2.9.1.1 - PWM Output (16-Bit, Mode 0)
- 2.9.1.2 - PWM Output (8-Bit, Mode 1)
- 2.9.1.3 - Period Measurement (32-Bit, Modes 2 & 3)
- 2.9.1.4 - Duty Cycle Measurement (Mode 4)
- 2.9.1.5 - Firmware Counter Input (Mode 5)
- 2.9.1.6 - Firmware Counter Input With Debounce (Mode 6)
- 2.9.1.7 - Frequency Output (Mode 7)
- 2.9.1.8 - Quadrature Input (Mode 8)
- 2.9.1.9 - Timer Stop Input (Mode 9)
- 2.9.1.10 - System Timer Low/High Read (Modes 10 & 11)
- 2.9.1.11 - Period Measurement (16-Bit, Modes 12 & 13)
- 2.9.1.12 - Line-to-Line Measurement (Mode 14)
- 2.9.2 - Timer Operation/Performance Notes
- 2.9.1 - Timer Mode Descriptions
- 2.10 - SPC (or VSPC)
- 2.11 - DB37
- 2.12 - DB15
- 2.13 - OEM Connector Options
- 3 - Operation
- 4 - LabJackUD High-Level Driver
- 4.1 - Overview
- 4.2 - Function Reference
- 4.2.1 - ListAll()
- 4.2.2 - OpenLabJack()
- 4.2.3 - eGet() and ePut()
- 4.2.4 - eAddGoGet()
- 4.2.5 - AddRequest()
- 4.2.6 - Go()
- 4.2.7 - GoOne()
- 4.2.8 - GetResult()
- 4.2.9 - GetFirstResult() and GetNextResult()
- 4.2.10 - DoubleToStringAddress()
- 4.2.11 - StringToDoubleAddress()
- 4.2.12 - StringToConstant()
- 4.2.13 - ErrorToString()
- 4.2.14 - GetDriverVersion()
- 4.2.15 - TCVoltsToTemp()
- 4.2.16 - ResetLabJack()
- 4.2.17 - eAIN()
- 4.2.18 - eDAC()
- 4.2.19 - eDI()
- 4.2.20 - eDO()
- 4.2.21 - eTCConfig()
- 4.2.22 - eTCValues()
- 4.3 - Example Pseudocode
- 4.3.1 - Open
- 4.3.2 - Configuration
- 4.3.3 - Analog Inputs
- 4.3.4 - Analog Outputs
- 4.3.5 - Digital I/O
- 4.3.6 - Timers & Counters
- 4.3.7 - Stream Mode
- 4.3.8 - Raw Output/Input
- 4.3.9 - Easy Functions
- 4.3.10 - SPI Serial Communication
- 4.3.11 - I²C Serial Communication
- 4.3.12 - Asynchronous Serial Communication
- 4.3.13 - Watchdog Timer
- 4.3.14 - Miscellaneous
- 4.4 - Errorcodes
- 5 - Low-level Function Reference
- 5.1 - General Protocol
- 5.2 - Low-Level Functions
- 5.2.1 - Bad Checksum
- 5.2.2 - ConfigU6
- 5.2.3 - ConfigIO
- 5.2.4 - ConfigTimerClock
- 5.2.5 - Feedback
- 5.2.5.1 - AIN: IOType = 1
- 5.2.5.2 - AIN24: IOType = 2
- 5.2.5.3 - AIN24AR: IOType = 3
- 5.2.5.4 - WaitShort: IOType=5
- 5.2.5.5 - WaitLong: IOType=6
- 5.2.5.6 - LED: IOType=9
- 5.2.5.7 - BitStateRead: IOType=10
- 5.2.5.8 - BitStateWrite: IOType=11
- 5.2.5.9 - BitDirRead: IOType=12
- 5.2.5.10 - BitDirWrite: IOType=13
- 5.2.5.11 - PortStateRead: IOType=26
- 5.2.5.12 - PortStateWrite: IOType=27
- 5.2.5.13 - PortDirRead: IOType=28
- 5.2.5.14 - PortDirWrite: IOType=29
- 5.2.5.15 - DAC# (8-bit): IOType=34,25
- 5.2.5.16 - DAC# (16-bit): IOType=38,39
- 5.2.5.17 - Timer#: IOType=42,44,46,48
- 5.2.5.18 - Timer#Config: IOType = 43, 45, 47, 49
- 5.2.5.19 - Counter#: IOType = 54, 55
- 5.2.6 - ReadMem (ReadCal)
- 5.2.7 - WriteMem (WriteCal)
- 5.2.8 - EraseMem (EraseCal)
- 5.2.9 - SetDefaults (SetToFactoryDefaults)
- 5.2.10 - ReadDefaults (ReadCurrent)
- 5.2.11 - Reset
- 5.2.12 - StreamConfig
- 5.2.13 - StreamStart
- 5.2.14 - StreamData
- 5.2.15 - StreamStop
- 5.2.16 - Watchdog
- 5.2.17 - SPI
- 5.2.18 - AsynchConfig
- 5.2.19 - AsynchTX
- 5.2.20 - AsynchRX
- 5.2.21 - I²C
- 5.2.22 - SHT1X
- 5.2.23 - 1-Wire
- 5.3 - Errorcodes
- 5.4 - Calibration Constants
- Appendix A - Specifications
- Appendix B - Noise and Resolution Tables
- Appendix C - Enclosure and PCB Drawings
- U6 Firmware Revision History
- Digit Datasheet (Discontinued)
- UE9 Datasheet
- Preface
- 1 - Installation
- 2 - Hardware Description
- 2.1 - USB
- 2.2 - Ethernet
- 2.3 - Vext (Screw Terminals and Power Jack)
- 2.4 - Comm and Control LEDs
- 2.5 - GND and SGND
- 2.6 - VS
- 2.7 - AIN
- 2.7.1 - Channel Numbers
- 2.7.2 - Converting Binary Readings to Voltages
- 2.7.3 - Typical Analog Input Connections
- 2.7.3.1 - Signal from the LabJack
- 2.7.3.2 - Unpowered Isolated Signal
- 2.7.3.3 - Signal Powered by the LabJack
- 2.7.3.4 - Signal Powered Externally
- 2.7.3.5 - Amplifying Small Signal Voltages
- 2.7.3.6 - Signal Voltages Beyond ±5 Volts (and Resistance Measurement)
- 2.7.3.7 - Measuring Current (Including 4-20 mA) with a Resistive Shunt
- 2.7.3.8 - Floating/Unconnected Inputs
- 2.7.4 - Internal Temperature Sensor
- 2.8 - DAC
- 2.9 - Digital I/O
- 2.10 - Timers/Counters
- 2.10.1 - Timer Mode Descriptions
- 2.10.1.1 - PWM Output (16-Bit, Mode 0)
- 2.10.1.2 - PWM Output (8-Bit, Mode 1)
- 2.10.1.3 - Period Measurement (32-Bit, Modes 2 & 3)
- 2.10.1.4 - Duty Cycle Measurement (Mode 4)
- 2.10.1.5 - Firmware Counter Input (Mode 5)
- 2.10.1.6 - Firmware Counter Input With Debounce (Mode 6)
- 2.10.1.7 - Frequency Output (Mode 7)
- 2.10.1.8 - Quadrature Input (Mode 8)
- 2.10.1.9 - Timer Stop Input (Mode 9)
- 2.10.1.10 - System Timer Low/High Read (Modes 10 & 11)
- 2.10.1.11 - Period Measurement (16-Bit, Modes 12 & 13)
- 2.10.2 - Timer Operation/Performance Notes
- 2.10.1 - Timer Mode Descriptions
- 2.11 - SCL and SDA (or SCA)
- 2.12 - DB37
- 2.13 - DB15
- 2.14 - OEM Connector Options
- 3 - Operation
- 4 - LabJackUD High-Level Driver
- 4.1 - Overview
- 4.2 - Function Reference
- 4.2.1 - ListAll()
- 4.2.2 - OpenLabJack()
- 4.2.3 - eGet() and ePut()
- 4.2.4 - eAddGoGet()
- 4.2.5 - AddRequest()
- 4.2.6 - Go()
- 4.2.7 - GoOne()
- 4.2.8 - GetResult()
- 4.2.9 - GetFirstResult() and GetNextResult()
- 4.2.10 - DoubleToStringAddress()
- 4.2.11 - StringToDoubleAddress()
- 4.2.12 - StringToConstant()
- 4.2.13 - ErrorToString()
- 4.2.14 - GetDriverVersion()
- 4.2.15 - TCVoltsToTemp()
- 4.2.16 - ResetLabJack()
- 4.2.17 - eAIN()
- 4.2.18 - eDAC()
- 4.2.19 - eDI()
- 4.2.20 - eDO()
- 4.2.21 - eTCConfig()
- 4.2.22 - eTCValues()
- 4.3 - Example Pseudocode
- 4.3.1 - Open
- 4.3.2 - Configuration
- 4.3.3 - Analog Inputs
- 4.3.4 - Analog Outputs
- 4.3.5 - Digital I/O
- 4.3.6 - Timers & Counters
- 4.3.7 - Stream Mode
- 4.3.8 - Raw Output/Input
- 4.3.9 - Easy Functions
- 4.3.10 - SPI Serial Communication
- 4.3.11 - I²C Serial Communication
- 4.3.12 - Asynchronous Serial Communication
- 4.3.13 - Watchdog Timer
- 4.3.14 - Miscellaneous
- 4.4 - Errorcodes
- 5 - Low-level Function Reference
- 5.1 - General Protocol
- 5.2 - Comm Functions
- 5.3 - Control Functions
- 5.3.1 - BadChecksum
- 5.3.2 - ControlConfig
- 5.3.3 - Feedback (and FeedbackAlt)
- 5.3.4 - SingleIO
- 5.3.5 - TimerCounter
- 5.3.6 - StreamConfig
- 5.3.7 - StreamStart
- 5.3.8 - StreamData
- 5.3.9 - StreamStop
- 5.3.10 - ReadMem
- 5.3.11 - WriteMem
- 5.3.12 - EraseMem
- 5.3.13.1 - WatchdogConfig
- 5.3.13.2 - WatchdogRead
- 5.3.13.3 - Extended WatchdogConfig
- 5.3.13.4 - WatchdogClear
- 5.3.15 - Reset
- 5.3.16 - SPI
- 5.3.17 - AsynchConfig
- 5.3.18 - AsynchTX
- 5.3.19 - AsynchRX
- 5.3.20 - I²C
- 5.3.21 - SHT1X
- 5.3.22 - StreamDAC
- 5.3.23 - SetDefaults (SetToFactoryDefaults)
- 5.3.24 - ReadDefaults (ReadCurrent)
- 5.3.25 - 1-Wire
- 5.4 - Low-Level Errorcodes
- 5.5 - Modbus
- 5.6 - Calibration Constants
- 6 - Low-level Native Examples
- Appendix A - Specifications
- Appendix B - Noise and Resolution Tables
- Appendix C - Enclosure and PCB Drawings
- UE9 Firmware Revision History
- U12 Datasheet
- 1 - Installation
- 2 - Hardware Description
- 3 - Example Applications
- 4 - Programming Reference
- 4.1 - EAnalogIn
- 4.2 - EAnalogOut
- 4.3 - ECount
- 4.4 - EDigitalIn
- 4.5 - EDigitalOut
- 4.6 - AISample
- 4.7 - AIBurst
- 4.8 - AIStreamStart
- 4.9 - AIStreamRead
- 4.10 - AIStreamClear
- 4.11 - AOUpdate
- 4.12 - AsynchConfig
- 4.13 - Asynch
- 4.14 - BitsToVolts
- 4.15 - VoltsToBits
- 4.16 - Counter
- 4.17 - DigitalIO
- 4.18 - GetDriverVersion
- 4.19 - GetErrorString
- 4.20 - GetFirmwareVersion
- 4.21 - GetWinVersion
- 4.22 - ListAll
- 4.23 - LocalID
- 4.24 - NoThread
- 4.25 - PulseOut
- 4.26 - PulseOutStart
- 4.27 - PulseOutFinish
- 4.28 - PulseOutCalc
- 4.29 - ReEnum
- 4.30 - Reset (or ResetLJ)
- 4.31 - SHT1X
- 4.32 - SHTComm
- 4.33 - SHTCRC
- 4.34 - Synch
- 4.35 - Watchdog
- 4.36 - ReadMem
- 4.37 - WriteMem
- 4.38 - BuildOptionBits (ActiveX only)
- 4.39 - FourPack (ActiveX only)
- 4.40 - Description of Errorcodes
- 5 - Low-Level Function Reference
- Appendix A - Specifications
- Appendix B - Dimensions
- Appendix C - U12 Hardware Troubleshooting
- Appendix D - Maximum Data Rates for the LabJack U12
- Accessories
11 comments
Strange low counts
Any idea why I might be getting strangely low timer values on occasion? For the majority of my sys timer value requests, I get good data. But sometimes, the LOWER value is an order of magnitude suspiciously low.
Here's my init code, run once before timing/counting begins:
int InitSystemTimer(counter_struct* counter)
{
// Configure Timer0 as system timer low
AddRequest(ljHandle, LJ_ioPUT_TIMER_MODE, X123_TLSW, LJ_tmSYSTIMERLOW, 0, 0);
// Configure Timer1 as system timer high
AddRequest(ljHandle, LJ_ioPUT_TIMER_MODE, X123_TMSW, LJ_tmSYSTIMERHIGH, 0, 0);
// now send all the messages
GoOne(ljHandle);
ePut(ljHandle, LJ_ioPUT_COUNTER_RESET, X123_COUNTER, TRUE, 0);
// flush last value
eGet(ljHandle, LJ_ioGET_COUNTER, X123_COUNTER, &counter->counts, 0);
// init the ticks
GetCountTime(counter);
counter->ticksInit = counter->ticks;
}
And here's my timer function that I run once a second thereafter:
int GetCountTime(counter_struct* counter)
{
// set up counter read
AddRequest(ljHandle, LJ_ioGET_COUNTER, X123_COUNTER, 0, 0, 0);
// set up read of internal system timer low and high words
AddRequest(ljHandle, LJ_ioGET_TIMER, X123_TLSW, 0, 0, 0);
AddRequest(ljHandle, LJ_ioGET_TIMER, X123_TMSW, 0, 0, 0);
// send all requests
GoOne(ljHandle);
// now get the results
GetResult(ljHandle, LJ_ioGET_COUNTER, X123_COUNTER, &counter->counts);
GetResult(ljHandle, LJ_ioGET_TIMER, X123_TLSW, &lower);
GetResult(ljHandle, LJ_ioGET_TIMER, X123_TMSW, &upper);
// combine timer MSW and LSW
counter->ticks = lower + upper * pow(2, 16);
// calculate the delta time
counter->time = (counter->ticks - counter->ticksInit) / LABJACK_SYS_TIMER_CLOCK;
}
I ran a quick test...
I ran a quick test and did not see any points that looked bad.
At what rate are you reading the timers? And how often do you see the bad readings?
details
I should have said that I'm using a U6, with latest firmware. I'm polling the timers at 1Hz with CVI LabWindows. I output my structure time value and it shows a very close 1HZ rate most of the time, with LABJACK_SYS_TIMER_CLOCK defined as 4e6.
I'm seeing these bad readings maybe once every 4-5 attempts of a unit test. In a unit test, there's about 500 timer requests. So it's pretty rare, but often enough that my unit test gets pretty fouled up. I'm at such a loss as to why the value would be borked. My counter structure is made up of all doubles.
typedef struct
{
double counts,
ticks,
ticksInit,
time,
rate;
} counter_struct;
Can you provide 10 or so
Can you provide 10 or so scans of raw (uncombined) timer values so we can see good readings and a bad reading.
I have not been able to
I have not been able to reproduce the error, but I think I have found what was causing it. Please send an email so that I can send you a new firmware version to try. The data set requested above may still be useful.
update
Before I patch any firmware, I wanted to post my results. Here is some history of data values, stopped when I get a bad point:
14:28:17: MSW = 19.000000, LSW = 4237101451.000000, combined = 4238346635.000000
14:28:18: MSW = 19.000000, LSW = 4241781934.000000, combined = 4243027118.000000
14:28:19: MSW = 19.000000, LSW = 4246301450.000000, combined = 4247546634.000000
14:28:20: MSW = 19.000000, LSW = 4250902229.000000, combined = 4252147413.000000
14:28:21: MSW = 19.000000, LSW = 4255320215.000000, combined = 4256565399.000000
14:28:22: MSW = 19.000000, LSW = 4259769907.000000, combined = 4261015091.000000
14:28:24: MSW = 19.000000, LSW = 4266328515.000000, combined = 4267573699.000000
14:28:25: MSW = 19.000000, LSW = 4270820926.000000, combined = 4272066110.000000
14:28:26: MSW = 19.000000, LSW = 4275193662.000000, combined = 4276438846.000000
14:28:27: MSW = 19.000000, LSW = 4279701423.000000, combined = 4280946607.000000
14:28:29: MSW = 19.000000, LSW = 4284152707.000000, combined = 4285397891.000000
14:28:30: MSW = 19.000000, LSW = 4288582525.000000, combined = 4289827709.000000
14:28:31: MSW = 19.000000, LSW = 4293062524.000000, combined = 4294307708.000000
14:28:32: MSW = 20.000000, LSW = 2615698.000000, combined = 3926418.000000
As I feared, bad data happens right at an overflow. The third column is my joined 64-bit number, but as you can see I've got a serious flaw there! I was shifting my bits only 16 places, rather than the full 32. Oops!
If I do the math on the last
If I do the math on the last three lines I get the following:
19, 4288582525 = 85,892,961,149
19, 4293062524 = 85,897,441,148
20, 2615698 = 85,901,961,618
Which looks correct.
duplicate values
Is there any reason why I'd be getting nearly duplicate values for the MSB and LSB sys timers?
upper: 3425196060
lower: 3425195997
Clearly, this is really just the lower that output each time, offset by the number of cycles it took to sample each. And yet my systimer setup looks good:
number of timers = 3
pin offset = 8
base, divisor, etc.
MSB = 1
LSB = 0
btw, in the LJ Control Panel, all is well. So there's just something I'm not getting right.
Your timer will be configured
Your timer will be configured for system timer low if its mode is set to 10, or the mode is not set. When not set, the mode defaults to system timer low.
For each timer, make sure its mode is configured before you start reading from it.
If you enable/disable timers or counters, previous timer mode settings are lost and reset to the default mode. Reconfigure timer modes after enabling/disabling timers or counters.
Ahh, interesting. Currently
Ahh, interesting. Currently in my system timer init function, I am setting the two states, 10 & 11 for lo/hi with a IO Set Config and then I'm also sending a IO Get Config for both, GoOne, then GetResults for both. In this function, both check correctly.
So I must be disabling the timers somewhere else by accident. You said that if any other timers/counters are disabled or enabled, this will result? That's surprising behavior. In my system, I need one counter and one PWM output timer. But both are initialized outside of the system timer.
Am I correct in thinking that all of these need to be configured simultaneously with a single GoOne in order to not be disabled inadvertently?
Disabling or enabling any
Disabling or enabling any timers or counters, or setting the timer counter pin offset (just double checked that one), will reset timer modes to their defaults. All timer modes need to be configured then. The reason is that those enable and pin offset settings are configured together in their low-level command-response to the U6. Basically after configuring with these UD constants all timer modes need to be configured: LJ_chNUMBER_TIMERS_ENABLED, LJ_ioPUT_COUNTER_ENABLE, LJ_chTIMER_COUNTER_PIN_OFFSET .
To prevent inadvertently disabling timer modes, you can configure timer/counter settings and all modes in one GoOne.
Alternatively, you can use the easy timer functions as timer/counter enabling and timer modes are configured together:
https://labjack.com/support/datasheets/u6/high-level-driver/function-ref...
https://labjack.com/support/datasheets/u6/high-level-driver/function-ref...