Hi,
I am running out of space for the code in the 18M2 I am using for my project and I was wondering whether there are good tricks to use when coding the Picaxe to reduce the memory footprint to make more room for extra functionality.
The project is nothing new for this forum, but it is for me, and a very good fun to do:
1) use of an AXE110 datalogger board to log the time at which the magnetic pulses from a domestic gas meter occur
2) send an hourly summary of the counts to a website using an ESP8266 WIFI module.
3) use an AXE33 LCD display which I use as a way of displaying the current readings and selecting a datalink mode (with push switches) to upload the logged pulses to a PC via the AXE027 cable
Because I am using an AXE110 board I cannot upgrade the Picaxe to a more roomy one so I am looking for tips and suggestions for doing what I need using less memory.
I do not have much experience in writing code for small environments so it would be greatly appreciated if someone could take a look at this program to suggest ways of making it smaller.
The code includes:
1) a section which reacts to the pulse from the gas meter
2) a section which reads the time from the RTC when a pulse occur, writes to the EEPROM and check it has been written correctly
3) a section which converts the RTC date and time readings to BCD for display
4) a section which reads the battery voltage and converts to a decimal number (e.g. 4.35V)
5) a section which deals with the transmission of the readings to the PC via the AXE027 cable
6) a section which uses the LCD and the push switches to display different messages and enter the datalink mode
7) a section which drives the ESP8266 WIFI module to upload the hourly summaries to the web server
What I still haven't dealt with is the error handling associated with the connection of the ESP to the router, the web server and the sending of the data. Something like the approach suggested by Hemi345 in this thread: http://www.picaxeforum.co.uk/showthread.php?26811-ESP8266-WiFi-serial-module/page3.
I have however RUN OUT OF MEMORY SPACE.
The code is attached. Any help or tips would be much appreciated.
View attachment Axe110_and_ESP8266_V1_for_forum.bas
Many Thanks
Riccardo
I am running out of space for the code in the 18M2 I am using for my project and I was wondering whether there are good tricks to use when coding the Picaxe to reduce the memory footprint to make more room for extra functionality.
The project is nothing new for this forum, but it is for me, and a very good fun to do:
1) use of an AXE110 datalogger board to log the time at which the magnetic pulses from a domestic gas meter occur
2) send an hourly summary of the counts to a website using an ESP8266 WIFI module.
3) use an AXE33 LCD display which I use as a way of displaying the current readings and selecting a datalink mode (with push switches) to upload the logged pulses to a PC via the AXE027 cable
Because I am using an AXE110 board I cannot upgrade the Picaxe to a more roomy one so I am looking for tips and suggestions for doing what I need using less memory.
I do not have much experience in writing code for small environments so it would be greatly appreciated if someone could take a look at this program to suggest ways of making it smaller.
The code includes:
1) a section which reacts to the pulse from the gas meter
2) a section which reads the time from the RTC when a pulse occur, writes to the EEPROM and check it has been written correctly
3) a section which converts the RTC date and time readings to BCD for display
4) a section which reads the battery voltage and converts to a decimal number (e.g. 4.35V)
5) a section which deals with the transmission of the readings to the PC via the AXE027 cable
6) a section which uses the LCD and the push switches to display different messages and enter the datalink mode
7) a section which drives the ESP8266 WIFI module to upload the hourly summaries to the web server
What I still haven't dealt with is the error handling associated with the connection of the ESP to the router, the web server and the sending of the data. Something like the approach suggested by Hemi345 in this thread: http://www.picaxeforum.co.uk/showthread.php?26811-ESP8266-WiFi-serial-module/page3.
I have however RUN OUT OF MEMORY SPACE.
The code is attached. Any help or tips would be much appreciated.
View attachment Axe110_and_ESP8266_V1_for_forum.bas
Many Thanks
Riccardo