Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Mon Nov 20, 2017 2:17 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Sep 29, 2011 10:16 am 
Offline

Joined: Thu Aug 09, 2007 4:44 pm
Posts: 67
I have a byte array called tripaxisletter. I want to send a particular byte from this array to a Galil motion controller as the letter it represents. If I send this:

Galil_request_position.command = "TD" + str(tripaxisletter[active])

it sends the numeric value of the byte. How do I send the letter?

Thanks


Top
 Profile  
 
PostPosted: Thu Sep 29, 2011 10:30 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Just for some background, the reason the code you have isn't working is that an individual element in a byte array is a byte. str(byteValue) is defined to convert that to a string containing its numeric value -- much like str(intValue) would. In most respects in Qlarity a byte is treated the same as an integer, except that it is limited in range from 0-255.

What you want is to extract a substring/array from your array (in this case, a single element substring). In Qlarity we use Mid to do that.
Code:
Galil_request_position.command = "TD" + mid(tripaxisletter, active, 1)

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group