Say one lesson that I learned. A friend of the boss commissioned us to make him a small controller. The time required for the project was relatively short and there was no time for circuit board. So we chose one of our former molding products based on what he said. Make a foundation and change on this basis.
The working process of this thing is very simple. It only needs to send the data from the sensor to two digital tables respectively, and then determine the action of the two outlet solid state relays according to the data transmitted by the sensor. There are 3 buttons, 3 lights, 2 solid state relays and 485 communication. We used the ATMEG8 as the control chip, using the internal 8M RC oscillator as the clock, the internal watchdog, the program written in C language, my C language level is not learned when you go to school, just when using the SCM With the compilation, this year we learned to use C language products.
I just tried the program and connected it to the sensor and the digital meter to display the data normally. According to the button, I can perform the specified actions. I think I'll pay for it without problems.
The colleague took the controller I made to install the wiring on the operation box. Later when debugging, the colleague told me that the device was dead...
I said no, I have configured the watchdog. Normal program errors can be reset. The power-on test of the device brought back by the colleague did not respond, and the re-burned film still worked properly.
Is it the ghost of static electricity?
Because our device originally had no buttons, this button is connected to the CPU pin of the device with 3 buttons on the operation box. There is no protection measure. Now that the air is dry in winter, static electricity is easily generated.
Change now!
Optocoupler isolation was added to all three buttons, and the test was changed to the control box. After a few moments, the Kung-fu colleague returned and said he was dead again. what! ? What's going on here?
I am a bit silly, is it a problem with my program? Check it out, read the program from beginning to end and did not see the problem.
It's strange to wipe the crashed movie and re-burn the program to work. Is it a problem with the operation box? How do I hang on the control box when I get this good thing?
Colleagues simply transported the operation box from the workshop to my office and let me do the experiment myself. Sure enough, just burning a good film on the operation box will crash for a while, and after repeated experiments, it is found to be dead after communicating with the digital meter. Further confirmation is that after the controller's EEPROM is modified after communicating with the digital meter, it will die. of. Remove the controller write EEPROM program is no longer dead, is it a problem with the GCC EEPROM library? No matter if you look at it, you can see it works normally. Anyway, this function is not important. Rewrite the chip and install it on the control box. Manual operation is no problem! The device starts to run automatically, how is it reset? Is it not clear?
Wait for a while....and reset again! After a wave of waves, what happened?
How can such a small program not exceed 2K? I am not so bad? Did such a small program not write well? Have to try to find out the problem! Repeatedly tried dozens of times to find the law, as long as it is the state of the automatic state of 1 and then reset the communication with the digital table, is not the problem of isolation 485 communication? Hands-on isolation (here to say about our hardware and software is responsible for two people, I do software, another colleague specializes in hardware), my colleagues just added the isolation of the button and added 485 isolation, in order to increase isolation The power supply was changed again on the basis of the original device. After changing the test installed, but also reset! God! My colleagues do not look at me with good looks!
OMG, what can I do?
Nothing can be seen from the procedural point of view. The odious M8 does not support simulation and does not see how the C language program is executed. No way but to use assembler to write the program, this I am familiar with and can be controlled at each step, certainly will not go wrong, a day plus one night to write the program out, the next day through the debugging, on the operation box, God! It's reset again!
wrong! Must be a hardware problem, colleagues said that it does not matter I give you a change of CPU board, colleagues and then changed a piece of CPU board sent to me, installed a test, how do you guess? Or not! Don't throw cabbage, I'm finished /_\, uh...I cry in my heart.
Suddenly I changed my mind. If I didn't, I couldn't think of hardware problems.
This time, I didn't say anything. I found another set of hardware that I hadn't changed. It was definitely a good test. I tried it with it.
Oh! This time it's all right. Don't worry anymore. I'll change the motherboard I changed to try this again. It's okay. Put my colleague who is doing the hardware, you see if it's snowing outside! What to explain? I am awkward! Catch up with Dou E! She snows in June, I snow in November! Colleagues did not say anything, took the comparison of the relay board and found good board two solid-state relay input resistance, bad input resistance difference of tens of euros, always reset that resistance is small, is not the impedance is too low microcontroller output capability Not enough cause? To the solid-state relay input string 200 ohm resistor, this line. Can work normally. Run for a while to see it.
After about half an hour, ah! It's reset again!
This time I wasn't nervous. It was definitely a hardware problem. I tried both the C language and the assembly. Take an oscilloscope to see if it is a reset foot interference? No. Look at the power supply? what? The CPU's 5V power supply is a big trough at reset, lasting about 50 milliseconds...
The culprit was finally found!
It is the quality of the power supply that is not good. When there is a relay action, and the communication comes, the power supply will be unusable. Colleagues don't say anything, reform the power supply, and increase the capacity of the power transformer and never reset it. Finally came to an end.
A small issue around the power supply, I turned a big circle and shared this lesson to remind everyone to pay attention.
We are a professional screen protector manufacturer, providing one-stop product production solutions, providing exclusive OEM and ODM services. A wide range of products, including HD Clear Screen Protectors, Self-repair Screen Protectors, Anti-microbial Screen Protectors, Matte Screen Protectors, Privacy Screen Protectors and other series.
We are committed to the development, production and sales of hydrogel screen protectors. We strictly control the screen protector production process to ensure that each product meets industry standards. If you want to know more products, please click the product details to view.
Whether you are a group or an individual, we will do our best to provide you with the best service and the most accurate and comprehensive product information!
Universal Screen Protector, TPU Screen Protector, Hydrogel Protective Film, Mobile Phone Screen Protector, Hydrogel Screen Protector, TPU Protective Film
Shenzhen Jianjiantong Technology Co., Ltd. , https://www.jjtbackskin.com