while waiting for a reply, I have tried an Arduino Due, and the Tune-monitor works. I think I was facing a Hardware limitation.
How to optimize code generation for Arduino Uno for Tune&Monitor?
조회 수: 1 (최근 30일)
이전 댓글 표시
(After few tries, I have updated the end of this post)
I just adapted the following arduino Code to display the character 'A' on a Nokia 5110 LCD screen. The arduino code is:
// Test to write a single character
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
void setup() {
Serial.begin(9600);
display.begin();
display.setContrast(50);
testdrawchar();
}
void loop() {}
void testdrawchar(void) {
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
display.write(65); //display the character 'A'
display.display();
}
The debugger provide the following output once compiled for Arduino Uno:
Sketch uses 8032 bytes (24%) of program storage space. Maximum is 32256 bytes.
Global variables use 884 bytes (43%) of dynamic memory, leaving 1164 bytes for local variables. Maximum is 2048 bytes.
The simulink code consist of : a contant uint8, a converter uint8, and a S-function I build with the s-function buillder.
I can build it, and deploy it succesfully:
Device: atmega328p Program: 16280 bytes (49.7% Full) (.text + .data + .bootloader) Data: 868 bytes (42.4% Full) (.data + .bss + .noinit) ### Deployed code to target successfully ### Successful completion of build procedure for: Nokia5110_Sfunction ### Simulink cache artifacts for 'Nokia5110_Sfunction' were created in 'C:\...\Nokia5110\Nokia5110_Sfunction.slxc'.
Build process completed successfully
I have improved the code using a slider to change the constant uint8. The build and deploy is succesful. However, the Tune and Monitor is throwing this error:
AVR Memory Usage ----------------
Device: atmega328p
Program: 38608 bytes (117.8% Full) (.text + .data + .bootloader)
Data: 1446 bytes (70.6% Full) (.data + .bss + .noinit)
### Build procedure for Nokia5110_Sfunction aborted due to an error.
The following error occurred during deployment to your hardware board: The generated code exceeds the available memory on the processor. It uses 117.8% of available program memory and 70.6% of available Data memory.
How can I optimize the code to make it tuneable from an arduino uno ?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!