Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I control lamp with Labview rs-232c serial communication?

Hello.

 

I want to turn on/off the LED lamp with rs-232c serial communication.

 

However, even though I checked the serial example, I have no idea that how to control the light intensity by the serial communication.

 

I would like to get some ideas about rs-232c communication.

 

Thank you 🙂

0 Kudos
Message 1 of 10
(4,938 Views)

What is controlling the lamp?  What is the message protocol for controlling the lamp?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(4,909 Views)

If you are just thinking of controlling a "dumb" (think IKEA lamp, or any off the shelf LED with no native control features built in)  LED lamp ON/OFF using RS232 then you probably want to look into toggling a relay via RS232.  But then you mention controlling the light intensity, so that suggests you want to also control the current the the LED.  At this point we really need more details.  

 

Which LED lamp?  Make and model?  Commands for RS232 communication would be helpful.

 

 

0 Kudos
Message 3 of 10
(4,883 Views)

Controlling the lamp means turning it off and on.

 

The protocol is like below :  

 

- 1 Byte only

- 0~255(00H~FFH) : minimum - 0(00H), maximum - 255(FFH)

0 Kudos
Message 4 of 10
(4,861 Views)

@GBLEE wrote:

The protocol is like below :  

 

- 1 Byte only

- 0~255(00H~FFH) : minimum - 0(00H), maximum - 255(FFH)


Then use a U8 to control the intensity.  Use Type Cast to convert it into a string and VISA Write to send the data.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10
(4,848 Views)

My explanation was wrong.

 

Actually, I dont know much about the serial communication.

 

But the lamp engineer told me like this.

 

The protocol is :

 

header : 0x80 (0x means hexagonal)

start : 0x02

start : 0x02

intensity 0x00 (off), 0x38~0xFF (56~255 : 1~99.5)

close : 0x03

close : 0x03

 

In order to turn on the lamp,

 

I should send the message to the lamp

 

80 02 02 FF 03 03 (The 'FF' can be any hexonal number to control the intensity).

 

To turn off the lamp,

 

we can send '80 02 02 00 03 03'.

 

How can i send this message to the lamp by the series communication?

 

Thank you.

0 Kudos
Message 6 of 10
(4,786 Views)

try something like this?

lamprs232.pnglampFP.png

used an event to catch a new value

the arrays  and the string indicator are set to display hex(adecimal ! ) values, and the control properties are changed to show decimal and hex 🙂

adding serial error and serial configuration details is now your homework 🙂

read the help files of the vis used ..

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 10
(4,781 Views)

Hi henrik.

 

Thanks for you comment.

 

But I cannot open you vi because its version (LV 18) is newer than mine (LV 15)

 

And now i'm trying to write hexadecimal number like your vi but i cannot mimic it.

 

Can you tell me how to send hexadecimal number?

 

Thank you.

0 Kudos
Message 8 of 10
(4,765 Views)

Take some hours until I have access to my LV PC ....

Take the time to read and practise some LV Basics ... 😄

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 10
(4,759 Views)

here we go

if you right click on constants/control/indicators you can change the display style (ether directly for strings, or via display format ,properties)

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 10 of 10
(4,751 Views)