Hi,
I just start using Labjack and still have many questions on it. I want to output PWM signals by using Stream out with Delphi.
I'm not so sure if i should use these functions ljm_ewritename/readname or the ljm stream functions for outputting the PWM.
e.g. i wrote :
ljm_ewritename(handle, 'STREAM_OUT0_ENABLE', 0) to disable the stream out System 0
As i said i don't know if it's ok to program it like this or should i just write the register's name without these functions(STREAM_OUT0_ENABLE :=0)?... and if it's the case(ewritename)... what about setting the target to a capable output? Referring to what i read ewrite just writes the value on the Target, but to set the target with stream_out man just needs to precise the address of the concerned target. so i wrote :
ljm_ewritename(handle, 'STREAM_OUT0_Target', 2600) what is meaningsless for me because a value has to be written not an address (or a string)
You will use eWriteNames for all the singular value registers and eWriteNameArray for the list of values. See "Example" towards the end of this page:
https://labjack.com/support/datasheets/t-series/communication/stream-mod...
Also, if there is not a Delphi stream-out example, open an example in some other text language. Perhaps "stream_basic_with_stream_out.c" from the C/C++ archive. You can open this in a text editor to look at the code:
https://labjack.com/support/software/examples/ljm/c
Actually, I'm not a Delphi programmer myself but I do see that there is a stream-out example in our Delphi archive for LJM:
https://labjack.com/support/software/examples/ljm/delphi
Note that sometimes there might be a reason to do PWM using stream-out, but most people use the DIO-EF system:
https://labjack.com/support/datasheets/t-series/digital-io/extended-feat...
ok thank you, i got it...
Now i want to stream out using the FIO_DIRECTION/ _STATE registers; but there is no visible channel like e.g. fio0...7.
I think i have to configure these state/direction registers to the normal one(fio#). :( i did'nt find how i can do it, also if is there any appropriated configuration function?
please can someone help me ?
I suspect you don't need to change direction on the fly, but rather you will change change states. If you are want to write the state of FIO7, you will set or clear the 8th bit of FIO_STATE.
Note also that the upper 8 bits of FIO_STATE are inhibits, so set those for other channels if you don't want to touch those channels:
https://labjack.com/support/datasheets/t-series/digital-io
Hi,
yes i did it . i read the states of the lines: ljm_ereadname(handle,'Fio_state',state) the 'state'=255 =ob11111111, means that all line are high logic on the fly. so to set my output to fio3 i must clear all bits except the 4th one and... write/leave this bit in the fio_state register . so far ok
but what about the stream_out#_Target register? will it contain the address of fio3 or fio_state?
logically i wrote:
nameOut: Fio_State; //i'm not sure about this one. fio_state or fio3?
AddressOut: integer; // address to stream_out
TypeOut:integer; // type to stream _out
ljm_nametoaddress (nameOut,pointer(AddressOut),pointer(TypeOut));// get the address of the target
ljm_ewritename(handle,'stream_out#_target',addressOut); // set the target to fio_state or fio3?
And the fact that fio_state needs to be read, it's logic to add it to the scanlist?
i see an example of steps to follow while streaming out:
after reading the fio_state,the target muss be updated. but we know that the only fio available for the stream_out are fio_direction/_state. so i can't get which target's address will be written to stream_ou#_target register
The 3.2.1 Stream-Out page mentions that FIO_STATE can be streamed out. (See "1. Target Selection").
I believe you need to use a different DIO range for stream out target as from stream in channels. E.g. use FIO_STATE for stream in, and EIO_STATE for stream out.
Hi Labjack Support,
i think the problem is not about the range i'm using. According to datasheet of t7-pro, for outputting pwm signals, i should use one of the targets for streaming out. Then i choose to use fio_state, but it sets the line to low(0) or high(1) and what i want is to output a succession of 0 and 1(not only low or high but a set of low and high).
And I also set the stream out_target to fio_state and the set of values (0,..,1)in stream out_buffer
one thing:how should i exactly know where (the visible line e.g. fio#(0...7)) the values will be sent. Because fio_state is not on the device,it is just abstract, but we use it for stream out.
For the device terminal locations of FIO0 through FIO7 (FIO_STATE), see Table 13.0-2 of 13.0 Digital I/O [T-Series Datasheet].