Hi everyone,
I am currently working on a project in which I have a labjack driven via USB by a Raspberry pi. The Raspberry uses the LJM library to send commands (set FIO to 1 or FIO to 2 for example). I need to write a Lua Script on the Labjack that emulates the reactions of the Labjack when receiving datas from raspberry: for exemple , when receiving FIO7 =1 set CIO0 =1. I need to check 8 DIOs.
I tried to Write a script that sets FIO5 and FIO4 according to level of the EIO2 and EIO3 (i enclosed the file to this message). The thing is that it doesn't works really well.
- When i launch the script at the begining, it doesn't consider the initilization of the DIOs made by the raspberry.
- When I set EIO3 to 1, nothing happens , and when i set EIO2 to 1 it seems to do what i expect, but it doesn't do it all the time. Also i need to put a "sleep" between the reading of the EIO3 and the writing of the DIOs. My questions are: Is it possible to do what i try to do (make the Lua Scripting cohabitate with the communication to Linux)? If yes, what did i do Wrong ?
I don't quite understand what you are trying to do but it sounds like you are using an FIO line as a shared memory value between a Lua script on the T7 and an application running on the Raspberry Pi. You should look at the USER_RAM registers, search for the word "User RAM Registers" on the T7 Scripting Datasheet Page. There are a few examples for using these included with Kipling.