Wednesday, November 12, 2014

Recoding to sharply reduce use of SRAM memory on Arduino for keypunch interface, plus beginning SAC socket assembly

I spent some time picking up a visa for China and then spent time with the 1401 restoration team at the CHM for lunch. Added to a heavy workload from my job, it left limited free time today. Tomorrow doesn't look much better as work is even heavier.


Major recoding underway, all aimed at reducing dynamic memory use. Even more static strings, such as initializers, moved to flash memory (PROGMEM). String objects changed to char arrays and manually managed. Strings that had extracted substrings converted to pointers into larger string. Unnecessary intermediate variables removed. Good thing I started in IT when we had machines with only a few thousand memory locations total, it developed good skills at space savings.

I did have to fight the Arduino development environment, in that I had to use some libC functions for the use of flash memory, string functions including functions that can access strings in flash memory, etc. I put in the #include statements but they didn't seem to work, or at least they failed with some functions, particularly memcmp_P which does a character by character compare of a string in dynamic (SRAM) memory and one in flash memory.

At this point, it appears I still have some problem that is exhausting RAM, leading to hangups or reboot of the Arduino, but it is possible that my problem could be something more fundamental and electrical in nature. Simultaneously, I will add a fairly hefty electrolytic capacitor inside the box to store up power to drive the relays and feed the Arduino, as well as instrument my code to report free memory at various strategic points through the program. If I see free memory getting low or declining in some suspicious way, it might point me at some further debugging.


My 160 pin socket, pins and mounting hardware arrived today from Digikey and I began setting up the socket to my four interface boards. I assembled the guide pins and laid out everything. The USPS didn't deliver the package until after 8PM tonight, which limited what I could accomplish.

My new socket hardware arrived - 160 pin connector for SAC interface box

Guide pins assembled onto the socket
Reference view of what a socket looks like when filled with female pins and installed in a chassis

No comments:

Post a Comment