Jump to content
43oh

superpanky

Members
  • Content Count

    2
  • Joined

  • Last visited

Everything posted by superpanky

  1. Maybe someone can try to tell, what could be wrong in these few lines? I don't understand, how these constructions with pointers and "unsigned char/int" datatypes do work. int pos=0; int counter=0; int p=0; void loop() { Flash.read(flash+(pos * sizeof(int)), (unsigned char*)&p, sizeof(int)); counter=p; if (.............) { counter=++counter; } else { counter=--counter; } Flash.erase(flash);
  2. Hello. I have wrote an Energia program for digital potentiometer control. I want to save variable "counter" (it is an integer number from 0-255) in non-volatile memory using mspflash.h library in case of reset or power interrupt. But it doesn't saves. I am allmost sure there is something wrong with initialization of variables or pointers inside my code. Can anyone help? Any improvements in code? My code: #include <SPI.h> #include "MspFlash.h" #define outputA P2_1 #define outputB P2_2 #define flash SEGMENT_D int aState; int aLastState; const in
×
×
  • Create New...