JonP

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by JonP

  1. I had renamed the variable and added in all of the recommendations and I am no longer getting the error, so there must have been some typo I had accidentally added.

    I am confused on why it is setting the array to {255,255,255,255,255,255} because these should be different numbers based upon the data being read from the sensor. I have it connected again to the isolated setup and the dataArray changes values, but on the main setup the values remain a constant 255. Would this be an issue of sensor connection to the labjack? I am using the same pins to run each process and there is no other conflicts, but I am running the isolated setup with a CB37 terminal board as opposed to a ribbon cable on the main setup. 

  2. I did put the dataArray before the tempx= line, but it still doesn't seem to print out anything. The IsEmpty(dataArray) does print 1, so dataArray is empty. Does this mean there is an error with the connection of the sensor to the labjack, or a conflict in the transfer of data?

  3. It still returns the error and does not print out ? dataArray, or ? tempx that I added after tempx = dataArray[0]*256 + dataArray[1]

    The error also persists after commenting out the while loop to attempt to run it a singular time. 

  4. I am trying to read data from a Relative Humidity/Temperature sensor and I keep getting error C1086 on line 53 " tempC = 175*tempx / 65535 - 45" when I am using this code on a Labjack U6 running numerous sequences for various processes. This error does not occur when I run it on an isolated Labjack with only sensor attached. I have checked all of my pin connections and there is nothing else running off of these pins, so there shouldn't be any conflicts. Can you point me in the right direction for troubleshooting this error, is there something wrong with my code or is there a conflict with this code and another sequence that I need to look into. I have attached the code below.

     

    // Set the I2C address

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chI2C_ADDRESS_BYTE,136,0,0)

     

    // SCL to CIO0

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chI2C_SCL_PIN_NUM,16,0,0)

     

    // SDA to CIO2

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chI2C_SDA_PIN_NUM,18,0,0)

     

    // Default (0) I2C options

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chI2C_OPTIONS,0,0,0)

     

    //MISO is FIO3 conflict and not used? So commented out

    //AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_MISO_PIN_NUM,3,0,0)

     

    //CLK is CIO0

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_CLK_PIN_NUM,16,0,0)

     

    //CS is CIO2

    AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_CS_PIN_NUM,18,0,0)

     

    //Execute the requests on a single LabJack.

    GoOne(ID)

    ErrorHandler(ID)

     

     

    This part above is done in a separate sequence but I included it as I think it may be related to the issue

     

     

    // initialize the variables

    private numWriteBytes=2

    private writeArray

    writeArray[0] = 36

    writeArray[1] = 0

    private dataArray

    private numreadBytes = 6

    private tempx

    private tempC

    private rh

     

     while(1)

       //Transfer the data (single shot acquisition command)

       ePut(ID, LJ_ioI2C_COMMUNICATION, LJ_chI2C_WRITE, numWriteBytes, @writeArray)

       ErrorHandler(ID)

     

       // Wait 20ms for the acquisition time

       delay(0.02)

     

      

       dataArray[0] = 0

       dataArray[1] = 0

       dataArray[2] = 0

       dataArray[3] = 0

       dataArray[4] = 0

       dataArray[5] = 0

     

       // Read the returned data

       eGet(ID, LJ_ioI2C_COMMUNICATION, LJ_chI2C_READ, numReadBytes, @dataArray)

       ErrorHandler(ID)

     

       // Convert the raw bytes to actual readings

       tempx = dataArray[0]*256 + dataArray[1]

       tempC = 175*tempx / 65535 - 45

       rh = dataArray[3]*256 + dataArray[4]

       rh = 100*rh / 65535

       // print the read to the command / alert window.  Of course you'll probably do something a bit more exciting with the data

       temperature.AddValue(tempC)

       humidity.AddValue(rh)

       ?Format("temperature=%0.4fC\nrh=%0.4f\n", tempC, rh)

       delay(0.5)

    endwhile

  5. I was originally steered away from a voltage issue due to the fact the computer does not crashes every time. The voltage for the pump is powered to the computer through a voltage divider into the NO port on the relay, and the COM port is wired to the LabJack which is connected to the computer through a usb connection. I am not sure how exactly Im supposed to wire this on a separate power supply as it is going to need to be portable and running off a 12V battery. I have also confirmed it not to be a memory issue during data collection. 

  6. I am running DAQ Factory to measure air quality data, using a pump running through a labjack setup. When normally running my program DAQ Factory collects data as normal and the sensors seem to be working fine on their measurements, however, when I switch the pump on one of two different crashes have happened so far: The pump turns on and off briefly, then the whole computer and monitor shut off; The pump and computer stay running, but no out put is displayed onto the monitor and the data stops being collected. After checking many components of my setup and testing certain situations, I am inclined to believe that there is a software issue rather than hardware. The crash log is just and unexpected quit message with an unknown error. Has anyone experienced this problem, or has any insight as to what might be happening?