altineller 4 Posted September 8, 2015 Share Posted September 8, 2015 Hello, I got my msp432 LP and started porting some of my previous code to the newer Energia MT, using the clock library. I want to measure number of variables from my sensors, and display them on the Sharp LCD board. Namely: float sensors[15]; Clock clockDisplay; Clock clockMeasure void setup() { ... clockDisplay.begin(update_display, 1000, 1000); clockDisplay.start(); clockMeasure.begin(measure_parameters, 1000, 100); clockMeasure.start(); ... } void update_display() { screen.clearBuffer(); screen.text(10, 10, floatToString(buffer, sensors[1], 2, 5, false)); screen.flush(); } void measure_parameters() { sensors[0] = ina219_A.getShuntVoltage_mV(); sensors[1] = ina219_A.getBusVoltage_mV(); sensors[2] = ina219_A.getCurrent_mA(); ... } So I have two clocks, one measuring and storing sensor values in a float array, the other (should be) displaying the values from the float array on to the LCD screen. I have verified that both the sensor reading and the display to be in working order indepedently, but it appears that the float[] is not accessible to both of the methods, i.e. it is not shared memory. What are the possible ways to fix this? What approaches should I take when I am dealing with this kind of system? Previously I used millis() inside the loop, to count, and trigger certain functions when the time is appropriate. It seems to me that Energia MT with MSP432 is really really nice, and I am planing to build all my new code on this. @@Rei Vilo We need more solid examples. Any help/ideas/recomendations are greatly appreciated. Best regards, C.A. Quote Link to post Share on other sites
altineller 4 Posted September 9, 2015 Author Share Posted September 9, 2015 Hello, Upon more debugging and coding, I found out that if you access i2c from a function driven by a clock, it crashes the sketch. For the above code if I move the measure_parameters inside the loop, and comment out the clockMeasure, it will run. Best regards, C.A. Quote Link to post Share on other sites
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.