jro1952 Posted September 3 Report Posted September 3 Hola, necesito AYUDA, soy entusiasta de temas técnicos, autodidacta, jubilado, pero con la mente intentando hacer cosas nuevas para mi conocimiento. El asunto es asi: desde un arduino controlo una placa Esp32 Cam, a la cual le ordenó sacar una foto y enviármela al serial port, la cual recibo correctamente, con su encabezado EB91 (ADJUNTO ARCHIVO). Genere un .vi con el cual pretendo primero, leer la trama, filtrar y guardar en un archivo binario con extensión. jpg. Aquí empieza mi problema; veo la trama correctamente filtrada pero no logro guardarla, a pesar de varios intentos.(Adjunto el vi). Genere un .vi para guardar como texto y lo hace correctamente. (Adjunto el .vi y su trama adquirida). Si alguien puede ayudarme será bienvenida su mano. Espero este claro el planteo. Gracias por su tiempo. Labview version 10, con windows vista, ya se del siglo pasado..bue es lo que hay...jajterminal.txtRECEPCIONFOTOTet.viterminalTrama.txtRECEPCIONFOTOBin.vi Quote
Rolf Kalbermatter Posted Saturday at 10:33 PM Report Posted Saturday at 10:33 PM (edited) On 9/3/2026 at 2:16 AM, jro1952 said: Hola, necesito AYUDA, soy entusiasta de temas técnicos, autodidacta, jubilado, pero con la mente intentando hacer cosas nuevas para mi conocimiento. El asunto es asi: desde un arduino controlo una placa Esp32 Cam, a la cual le ordenó sacar una foto y enviármela al serial port, la cual recibo correctamente, con su encabezado EB91 (ADJUNTO ARCHIVO). Genere un .vi con el cual pretendo primero, leer la trama, filtrar y guardar en un archivo binario con extensión. jpg. Aquí empieza mi problema; veo la trama correctamente filtrada pero no logro guardarla, a pesar de varios intentos.(Adjunto el vi). Genere un .vi para guardar como texto y lo hace correctamente. (Adjunto el .vi y su trama adquirida). Si alguien puede ayudarme será bienvenida su mano. Espero este claro el planteo. Gracias por su tiempo. Labview version 10, con windows vista, ya se del siglo pasado..bue es lo que hay...jajterminal.txtRECEPCIONFOTOTet.viterminalTrama.txtRECEPCIONFOTOBin.vi I haven't looked at the VIs yet but could it be that you use the Write to Text File node and have not disabled the convert EOL option on it? If you want to write binary data, it is usually better to use the according Write to Binary File instead, but here you must not forget to wire a FALSE to the prepend array of string size input if the binary data is already the final format you need in the file. Edited Saturday at 10:34 PM by Rolf Kalbermatter Quote
jro1952 Posted Sunday at 12:27 AM Author Report Posted Sunday at 12:27 AM Hola, gracias por su respuesta, el archivo de texto lo realice para verificar que los datos recibidos sean los correctos. Los datos que recibo es una foto, los envia la Esp32 via arduino, la intención es recibirlos, archivarlos en un file jpg y luego levantarlos y presentarlos en una solapa dedicada. Verificare sus indicaciones y me mantengo atento a su revisión de mis .Vi Gracias por su atención 👍 Quote
ShaunR Posted Monday at 09:28 AM Report Posted Monday at 09:28 AM I don't have an Arduino to hand but here is a quick and dirty conversion of your dump file so you can see how it would be done. Not much in the JPG to look at though str2jpg.zip Quote
Rolf Kalbermatter Posted Monday at 09:47 AM Report Posted Monday at 09:47 AM (edited) Shauns code is more robust than just scanning the lines. But you should NOT use Bytes at Serial Port ever (with a few very rare exceptions that you are unlikely to ever encounter)! This is the default presentation that everybody should watch who is trying to implement serial port communication in LabVIEW: https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial Once you fixed the serial port communication, by using the termination character properly that you already enabled in the Serial Port Init by default, and simply removing the Byte at Port completely and instead wire a large number like 512 to the byte to read input, your main problem is this part of your code. You should replace this with this part of Shaun's code: Your code currently only converts the first two hex parameters of every received byte sequence and with your Bytes at Serial Port function you frequently won't receive an entire line, so only convert part of it. The remainder will be read in the next iteration but totally throw the Match Regular Expression function off the tracks as it does not see the expected line header. Edited Monday at 09:48 AM by Rolf Kalbermatter Quote
ShaunR Posted Monday at 11:04 AM Report Posted Monday at 11:04 AM 1 hour ago, Rolf Kalbermatter said: This is the default presentation that everybody should watch who is trying to implement serial port communication in LabVIEW: https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial Lots of exclamation points against using Bytes At Serial Port and then goes on to use Bytes At Serial Port More seriously though. You avoid a lot of the problems if you just pop up on the read prototype and set it to Synchronous IO mode instead of Asynchronous. Quote
jro1952 Posted Monday at 10:50 PM Author Report Posted Monday at 10:50 PM 13 hours ago, ShaunR said: No tengo un Arduino a mano, pero aquí tienes una conversión rápida y sencilla de tu archivo de volcado para que veas cómo se haría. Aunque no hay mucho que ver en el JPG. str2jpg.zip 25,08 kB · 3 descargas Muchas gracias por tu ayuda, con pequeños cambios lo adapte para que lea la trama del Visa y funciona de maravillas. Lo tuyo es muy profesional. Un saludo, desde Córdoba, Argentina 🫡 PD: se ve poco en la fotito ejemplo 😁 Quote
jro1952 Posted Monday at 10:55 PM Author Report Posted Monday at 10:55 PM 13 hours ago, Rolf Kalbermatter said: El código de Shaun es más robusto que simplemente escanear las líneas. ¡Pero NUNCA debes usar Bytes en el puerto serie (salvo algunas excepciones muy raras que probablemente nunca encontrarás)! Esta es la presentación predeterminada que todo aquel que intente implementar la comunicación por puerto serie en LabVIEW debería ver: https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial Una vez que hayas solucionado el problema de comunicación del puerto serie, utilizando correctamente el carácter de terminación que ya habilitaste en la inicialización del puerto serie por defecto, y simplemente eliminando por completo el byte en el puerto y en su lugar conectando un número grande como 512 al byte para leer la entrada, tu principal problema es esta parte de tu código. Debes reemplazar esto con esta parte del código de Shaun: Actualmente, tu código solo convierte los dos primeros parámetros hexadecimales de cada secuencia de bytes recibida, y con tu función Bytes en el puerto serie, con frecuencia no recibirás una línea completa, por lo que solo convertirás una parte. El resto se leerá en la siguiente iteración, pero esto desbaratará por completo la función Match Regular Expression, ya que no detecta el encabezado de línea esperado. Me queda claro tu sugerencia, Byte a port, fuera. Ahora probaré la modificación que indicaste, entiendo que funcionará sin problemas. Muchas gracias por tu ayuda. Asunto Solucionado, Tema cerrado. Un saludo desde Córdoba, Argentina.🤛 Quote
grittyratchet17 Posted 1 hour ago Report Posted 1 hour ago (edited) jro1952 said: Hello, I need some HELP. I’m a technical enthusiast, self-taught and retired, but my mind is still trying to learn and experiment with new things. Here’s the situation: using an Arduino, I control an ESP32-CAM board and tell it to take a photo and send it to me through the serial port. The image arrives correctly, and I can see the complete data stream, including the EB91 header. I’ve attached the received file. I created a .vi that is supposed to read the data stream, filter it, and then save only the image data into a binary file with a .jpg extension. This is where my problem starts. I can see the filtered data correctly inside LabVIEW, but after several attempts I still cannot get the JPG file to save properly. I’ve also attached that .vi so you can see what I’m doing. As another test, I created a different .vi that saves exactly the same data as text, and that works correctly, so I suspect I’m handling the binary format or conversion incorrectly before writing the file. After spending too much time fighting with bytes and data streams, I sometimes switch to something completely unrelated and browse slotimologin Casino, where slots have different themes, mechanics, and visual styles, while live games have a different pace and presentation. If anyone can point out what I’m doing wrong in LabVIEW, any help would be greatly appreciated. Thanks for your time. Sí, se entiende el planteo. Para guardar una imagen JPG no conviene tratar la trama como texto, porque cualquier conversión a string “normal”, fin de línea, encoding o formato puede modificar bytes y el archivo queda inválido. En LabVIEW deberías abrir el archivo con Open/Create/Replace File en modo binario, y escribir directamente los bytes filtrados con Write to Binary File. Asegúrate de que lo que llega al write sea un array de U8 o un string tratado como datos binarios, sin pasar por funciones de texto. También revisa que estés eliminando solo tu encabezado EB91 y no bytes propios del JPG; normalmente un JPG empieza con FF D8 y termina con FF D9. Si después de filtrar el primer byte útil no es FF D8, ahí probablemente está el problema. Edited 1 hour ago by grittyratchet17 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.