Hi, @abd42
Tom....
![]()
Hi, @abd42
Tom....
![]()
My program is using 68% memory almost 22 KBs and the free space is 32% almost 10 KBs.
Its a good idea, i not think about it.
Currently we are using Atmega328P chip alone in another project so we decide to continue in same way in this project also.
Maybe because my background specialization is power. I have started learning electronics from past some months including circuit design, pcb design, microcontroller programming, analog as well as digital electronics.
This is my first design in which design errors are possible.
Please provide some suggestions from which i improve my designs in circuit as well as in pcb and software development.
I am sure they will prove valuable for me in future.
Thanks.
12 pF
Just out of interest, what happens if you run the code on an Arduino board like the Uno or Nano classics ?
I have tried to run on Arduino UNO as well but there no problem occurs.
Then i put the same controller in the PCB also there the problem not came.
I ran with Arduino UNO 20 times and pull out that same controller and put in my PCB and runs for 25 times so in that duration no problem occurs.
As i told earlier the problem occurs sometimes not everytime.
That is not what is relevant. It's about the RAM usage, not the program memory usage.
Then 15pF is OK.
It's highly unlikely that the crystal is oscillating at 10 times it's frequency, besides the processor can't run that fast anyway, so the problem is somewhere else.
Might be EMI from the solenoids.
As I pointed out you 328 symbol seem to be wrong.
You should also have 0.1uF capacitor between Vcc and ground close to the Vcc pin.
You should also have 0.1uF capacitor between Avcc and ground close to the Avcc pin.
Aref should not connect to 5V but should also have a 0.1uF cap to ground
Reset should have a 0.1uF cap to ground.
Any digital IC should have a 0.1uF cap between Vcc and ground
Thanks
Currently i am using 22 uF as decoupling cap which is too large so i will replace it with 0.1 uF.
Yes, 22uF sounds like an electrolytic, and is not a very good bypass capacitor.
This is a very good video on what capacitor to use where and why.
Tom....
![]()
Correctly indented:
pres_up:
Button_Read();
if ( tar_pres_up == HIGH && pres_target <= 144) {
pres_target++;
pres_deci(pres_target, pres_target0); pres_target0 = pres_target;
Buzzer();
goto pres_up;
}
}
This is not the right way to do it in C/C++. Get rid of all labels and goto in your program. This part could be a while() loop or even a simple if() as long as there is no blocking code inside your main loop(). Read "Blink without delay" to get an idea on how to do that.
This would benefit from indentation:
while (pres_psi < 5) {
digitalWrite(buzzer, HIGH); //buzzer
digitalWrite(11, LOW);
digitalWrite(13, LOW);
showError();
Button_Read();
if (tar_pres_up == HIGH || tar_pres_down == HIGH || MenuCancel == HIGH || refill == HIGH) {
digitalWrite(buzzer, LOW); //buzzer
lc.clearDisplay(0);
goto work_mode;
}
}
to show the goto inside a while () loop. This is calling for trouble! Is your code translated from BASIC? You should rewrite it from scratch, one functionality at a time.
void functions don't have a return value.
Yes i have seen this video
next time i will place another 0.1uF capacitor in parallel with 22uF as close to ICs.
But we have only THT components available not SMD.
Thanks for that video.
Thanks for your help.
I will make changes to my code.
Shouldn't make a difference with a prototype, solder a through hole on place.
If the 22uF is SMD, then solder a wire cap over the top, use the same solder pads.
Tom....
![]()
You should keep the 22uF but add 0.1uF as I described.
I have changed my code and remove LedControl Library and using shiftout commands to display data but still the issue remains. The issue is coming in form of
In all problems turning OFF and then ON the machine solves the problem.
We keep hold the up button so value start going up and while going up any of the issue comes however we keep that button pressed.
The issue comes 25% means on running machine the issue almost come 3 times out of 12 times.
I have checked following approaches
Upload led blink program to test crystal on that pcb the led blink program working well (but i did not do enough testing)
There is no voltage dips (means there is 5V constant)
The crystal is connected at pin 9 and 10, touching pin 9 introduces any of the above problem (like this pin is acting like very sensitive), however pin 10 is also sensitive but not that much like pin 9. (Maybe cold solder or whatever)
The problem is the exact reason for problems is not identified yet and what we are doing is only guessing the problem this occurs and this is not.
That is normal, touching the pin will cause the frequency to change or xtal to stop.
The problem could still be poor layout, bad parts assembly, bad solder joints.
I think you need to write some special test software and start debugging with a scope.
Thanks for your feedback
But we dont have oscilloscope.
So i think i should try to change the layout and then try to test the machine