9:28 pm
May 4, 2016
Hi,
I wrote a simple program that acquires information (weight and barcode) from a scanner-scale via RS232 and then determines if the product is under control (with LEDs). However, it starts working fine and after a little while it freezes. I am using an arduino mega... So I supposely have enough memory. I am attaching my code. What I am doing wrong? I was reading regarding the use of bytes instead of strings, but that complicates things for the searching part of my code.
Help! Thanks.
8:02 pm
March 2, 2016
Hello,
Please take care of memory management. generally it happens when you use build array of concatenate string function. So it will slowly it drains all the memory. So i suggest you to optimize the code. You connect a LCD and write memory in every iteration to check how fast it drains.
So do the modifications and let me know if it works you.
Else i'm not able to check the code as of now, & will reply you in the morning if i see any change.
Regards
Love Diwan | http://www.pujacontrols.com
8:31 pm
May 4, 2016
lovediwan said
Hello,Please take care of memory management. generally it happens when you use build array of concatenate string function. So it will slowly it drains all the memory. So i suggest you to optimize the code. You connect a LCD and write memory in every iteration to check how fast it drains.
So do the modifications and let me know if it works you.
Else i'm not able to check the code as of now, & will reply you in the morning if i see any change.
Regards
Love Diwan | http://www.pujacontrols.com
Thanks for your answer Love,
I believe you are right... as the program starts to work fine and after a while scanning barcodes the program stops working. I am using strings to read the RS232 response from the scanner-scale and compare it against another string value previously saved. I am not sure how to optimize the code... how can I substitute those strings so the RAM memory does not get all used? I Could you look up at my code to offer some suggestions? I am attaching a new version which I wrote in LabVIEW 2014 but I could convert it to other previous version if you need to.
Thanks again for your answer!
3:19 am
March 2, 2016
Hi
few steps u just remember
- always initialise the array to the maximum. Like in ur case initialise a byte array with 255 as u are reading a barcode so it can be mostly a keyboard characters. And read a byte array string.
- Convert all the strings to byte array and use functions as u want it.
More I'll reply u by noon.
Regards
Love Diwan | http://www.pujacontrols.com
15
1 Guest(s)