Sign in to follow this  
Followers 0
DLB

Image >> Byte Array >> Image

12 posts in this topic

Hi, I have an image that I am looking to transfer from 1 PLC to another (say PLC1 to PLC2 for example). From PLC 2 it will be read by a HMI and displayed on screen. If the image is converted to a Byte array and passed from PLC1 to PLC2, what is the easiest way to convert this array back into an image? I will be displaying the image in Citect and don't imagine that it is clever enough to deal with this. I have thought about using DDE & RSLinx Classic to read the byte array elements into Excel, then use VBA to write the byte array to a file. Citect would then open the file as an image. Has anyone got any better ideas? Or even any info on the method I've described? **EDIT** It's just dawned on me that Citect supports VBA functions. Maybe I could just code the conversion from Byte Array back to image file in a Citect VBa file? Thanks Edited by DLB

Share this post


Link to post
Share on other sites
Just curious, why would you need to transfer an image from one PLC to another?

Share this post


Link to post
Share on other sites
I asked the same question to a colleague who is providing me with the bye array on the second PLC. It's my job to try and get it built back up into an image file. I'm still not entirely sure why the image is not being hosted elsewhere so that the SCADA terminal can read it or even why it isn't FTP'd directly from the CCTV system that is grabbing the image to the SCADA terminal. That part is out of my hands at the moment, I just need to find the most efficient way of building the byte array back up into an image file. Any help would be great :)

Share this post


Link to post
Share on other sites
I think you need to define "Image" a little better. PLC's don't do *.jpg's ect. what PLC platform and what HMI are you using Edited by tommu56

Share this post


Link to post
Share on other sites
The original image will most likely be of JPG or BMP format. I am told that the image file will be converted to an array of bytes. I am unsure of the model of the PLC which will create this byte array from the image file (which is originally stored on a the disk of a device acting as a DVR), but it will be passed to an Allen Bradley ControlLogix over a Rockwell DF1 radio link. The ControlLogix is where I need to read the byte array from and read the array elements back into a the correct file format. When the system is under development I will know for definite which type of image file (JPG or BMP) is being used so will know of the extension to apply to the built file. The image will then be displayed on a SCADA terminal running Citect. I know that Citect supports the display of BMP files. If it does not support JPG files then an image of that format will require further processing to convert it to BMP. If anyone else can think of a better solution to passing the image down the chain to Citect I'd be glad of it. I think the reason for the current situation is due to network segregation, ie the SCADA terminal is unable to see the first PLC (the one that holds the initial byte array representing the image file). I understand the concept seems a little unorthadox but it's not my call as to how the image is dealt with. I'm just investigating someone elses idea :)

Share this post


Link to post
Share on other sites
There is not any to move a jpeg or some thing like that that I know of, you could do it in ascii in a data file or if its just numbers numbers in a data file using a message statement. can you attach a file or image of what you want to pass and find out all the hardware in the chain.

Share this post


Link to post
Share on other sites
I'm not sure quite what you mean? Do you mean list the elements of the byte array in a data file and read them from there? The way I am looking at it is that the PLC will have a register holding an byte array. If I read the array from the PLC like I read any other tag, I then need to make Citect process the array elements into a file and give it the correct extension (.jpg/.bmp). I'm thinking that a VBA function might be able to handle this?

Share this post


Link to post
Share on other sites
This is what the data files (one bit and one integer) look like in logixs 500 you would need the driver in Citect to read the file from the plc

Share this post


Link to post
Share on other sites
Aha, i understand what you mean now. However we are going to be using RSLogix5000 :) Reading the data from the PLC won't be a problem, it is the coding (Cicode or VBA) to build the array elements back into a file that I am unsure of.

Share this post


Link to post
Share on other sites
500/500 are similar except for the tags part I only have one 5000 controller so I'm not all the way up to speed on it. Dig in to this link they might have something that will work its open source too. source link on the DDE to VB My link My link My link good luck

Share this post


Link to post
Share on other sites
the easiliest way to convertimage to byte arrayi believe is to use a 3rd party image software. donnot need to be so complicated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0