My program starts workin and after a while it freezes | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
My program starts workin and after a while it freezes
May 4, 2016
9:28 pm
Avatar
jared.ocampo
Member
Members
Forum Posts: 4
Member Since:
May 4, 2016
sp_UserOfflineSmall Offline

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. 

May 9, 2016
8:02 pm
Avatar
lovediwan
Member
Members
Forum Posts: 14
Member Since:
March 2, 2016
sp_UserOfflineSmall Offline

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

May 9, 2016
8:31 pm
Avatar
jared.ocampo
Member
Members
Forum Posts: 4
Member Since:
May 4, 2016
sp_UserOfflineSmall Offline

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!

May 10, 2016
3:19 am
Avatar
lovediwan
Member
Members
Forum Posts: 14
Member Since:
March 2, 2016
sp_UserOfflineSmall Offline

Hi

few steps u just remember

  1. 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. 
  2. 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

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
15
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356