Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

How to check a HEX file. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Microcontrollers

Comments on the article Comments on the article

Many radio amateurs, trying to repeat this or that device on a microcontroller according to a magazine publication, often encounter difficulties that are inexplicable at first glance. It would seem that the health of the microcontroller is beyond doubt, and the programmer is in perfect order, and the device is assembled exactly according to the scheme, but it refuses to work as it should. In such a situation, complaints about the author of the development are not uncommon - he presented, they say, an inoperable program!

In fact, in the vast majority of cases, things are different. The mistakes made during the manual input of the HEX-file of the program into the computer by its "printing" on the pages of the printed edition are to blame. Much less often there are failures when copying files from floppy disks or "downloading" them from the Internet. How to check a HEX file? The answer to this question is in the published article.

Any, at first glance, the most harmless, at first glance, typo in the HEX file leads to the execution of an incorrect command by the microcontroller (MC), often completely distorts the specified algorithm of its operation and can lead to completely unpredictable behavior of the manufactured device. Not a single most qualified specialist in this situation will be able to accurately indicate the location of the error by external signs.

It remains to check the HEX file with the original very carefully and repeatedly. The peculiarity of our psyche is that, having checked something once, we are subconsciously convinced of our own infallibility, and during repeated checks we often miss what we did not notice the first time. Therefore, it is useful to have an assistant who, without even delving into the essence of the work, will carry out "independent control".

In no case should you leave without checking the texts of programs read by the scanner with subsequent recognition using the FineReader program and the like. Practice shows that character recognition errors are inevitable even with very high quality printed text.

When entering HEX files manually (from the keyboard) or their electronic versions obtained by scanning, the following most often happens:

  • instead of the Latin letters A, B, C, E, Russians similar to them were introduced;
  • instead of the number 0, the letter O (Latin or Russian) is entered;
  • the letter B and the number 8 are mixed up;
  • instead of the number 1, the letter I (lat. "i" uppercase) or I (lat. "el" lowercase) was entered. In the fonts of some typefaces, these characters are very similar;
  • the order of characters is violated;
  • the line is missing a few characters or there are extra ones;
  • whole lines are missing;
  • some lines are entered twice.

The most harmless of these defects is the last one. Unlike others, it does not affect the performance of the program. The same in most cases can be said about the violation of the order of the lines. However, programmers who provide strict control over the correctness of the input data can still reject a file with such errors.

It must be said that the control of the correctness of the structure of the HEX-file in the process of reading it from the disk is performed by the software of very many programmers. Certain possibilities for this are inherent in the very structure of such a file, which can be read, for example, in the author's article "Development and debugging of devices on the MK" ("Radio", 2001, No. 5, p. 19). The trouble is that the programmer often reports only the fact that an error has been detected without any details, leaving the user to figure it out for himself. In this case, the defective file often turns out to be completely or partially loaded into the programmer, and if you carelessly give the "Programming" command, erroneous data will be transferred to the MK's memory. After that, verification will be successfully completed (verification of the contents of the memory of the MK and the programmer) and the user will get the impression that everything is in order.

In this regard, the program PonyProg (version 2.05 and earlier) behaves very dangerously. In addition to HEX, it provides several other input file formats, and when loading, it tries to choose the right one on its own. Not correctly recognizing the file format with errors, she still enters it as binary. On fig. 1 shows the view of the PonyProg programmer window after such input.

How to check a HEX file

The memory contains not machine command codes, but ASCI codes of letters and numbers that make up a text HEX file. Naturally, according to such a "program" MK will not work. The view of the same window after entering the error-free file identical to the first one is shown in Fig. 2. Note that the programmer did not give any error messages or about automatically determined file format in both cases.

How to check a HEX file

The program will be able to help find and correct errors in the HEX file before entering it into the programmer. CheckHEX. With its help, you can create a new HEX file by typing its contents on the computer keyboard. In the latter case, the verification takes place simultaneously with data entry.

The data window of the CheckHEX program after entering a HEX file containing several errors is shown in Fig. 3. In its upper part, on the left, the current coordinates of the cursor are displayed, showing where the character will be entered when the key is pressed.

How to check a HEX file

On the right there is a window, by clicking on it with the "mouse", you can cancel or re-enable error checking at any time. Blocking control can be useful for the duration of manual data entry, otherwise each incomplete line is accompanied by a lot of messages that only distract attention. The warning and error message window (Fig. 4) is located below the main one. Messages beginning with the word "Information" only indicate the special status of certain lines of the HEX file. In this case, there are two such lines. The first of them is optional, since in its absence, the address count will start from zero. Such lines (there may be several of them in different places in the file) allow you to address more than 64 KB (32 Kwords) of memory. It is their presence that distinguishes HEX files of the INX32 format from those of the INX8M format.

How to check a HEX file

Line 25 marks the end of the HEX file. If any data is after it (line 26), it will not be accepted by the programmer. This can be used, for example, to place a text comment in a HEX file. In the example, line 20 of the source file was simply moved here, which remained empty. In principle, the presence of empty lines in a HEX file is acceptable, but some programmers may still consider them errors. The CheckHEX program, just in case, warns about this.

Note the checksum error message on line 3. It may be the result of a mistyped character in any (except colon) character of the string, which should be checked very carefully. The "correct" checksum given in brackets is useful if one or more characters of the string have been changed intentionally (for example, to correct an actual program error). In this case, the error is the result of entering the number 8 instead of the letter B.

The nature of the error in the fifth character of the fourth line is clear. We only note that to facilitate the visual search for errors, the text font in the main window does not contain Cyrillic characters, their place is occupied by characters that have nothing to do with the correct ones. However, Russian letters are presented in error messages.

To the right of the data window, there is a window showing the picture of filling the MC memory with codes from the analyzed file. A fragment of this window is shown in Fig. 5. White color corresponds to free cells, blue or red - occupied. The explanatory inscriptions in the figure (they are not in the real window) refer to the typical memory distribution for RIS controllers, for other MKs and EPROMs it can be completely different. By moving the mouse cursor inside the window, you can determine the address of any of the cells displayed there. In this case, the cursor (crosshair in the upper right part of the window) points to the byte at address OOSON - junior in the two-byte word at address 0060H.

How to check a HEX file

Of course, a user who has not developed a downloadable program and has not carefully analyzed it, as a rule, does not know which cells should be occupied and which should not. Nevertheless, it makes sense to pay attention to gaps in the continuous sequence of occupied cells and make sure once again that they did not appear as a result of errors, as in the case under consideration.

The red segment indicates that the codes entered at these addresses have been encountered in the file more than once. In the example (see Fig. 3), the seventh and eighth lines are identical. If the duplicate row is the result of inattention during manual data entry, it can be deleted. But more often the mistake made in the address part of the line (characters from the fourth to the seventh) is to blame. In such a case, not only the codes at erroneous addresses will be distorted, but the memory area to which the given line originally belonged will also remain undefined. All this needs to be checked again and again.

In conclusion, we note that there are three control buttons in the CheckHEX program window: - create a new HEX file; - open and check existing ; - save the created or edited file. When you try to upload or create another file without first saving the modified version of the old one, the program always reminds you of the need to do so. The same happens before the program terminates.

Author: A. Dolgiy, Moscow

See other articles Section Microcontrollers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

Transparent and silent robotic eel developed 28.04.2018

American scientists have developed a transparent and silent robotic eel, which is supposed to help in the study of marine life.

While robotic fish have previously been developed to discreetly study marine life, scientists are still more likely to use remote-controlled vehicles with loud propellers that frighten underwater inhabitants. This, however, could change with the development of a completely silent, transparent, soft eel robot. The model for creating the device, as noted, was leptocephali - a special stage of larval development of fish of the superorder Elopsoid, including eels.

The device was developed by specialists from the University of California at San Diego and the University of California at Berkeley. The length of the robot reaches about 0,3 meters, can work in salt water and is driven not by a motor, but by artificial elastomer muscles filled with water.

He receives electricity through wires coming from a special unit located on the surface. The device directs positive electrical charges into the water chambers in the muscles, and negative charges into the surrounding water. This allows the robot's muscles to flex and extend, allowing it to undulate through the water at a speed of 1,9 millimeters per second.

The robot has been successfully tested in aquariums containing jellyfish, coral and fish. Now scientists plan to improve the structure and reliability of the robot and equip it with a functional ballast system. In the future, he may also receive a "head" containing various sensors, in particular cameras.

Other interesting news:

▪ Laser ignition

▪ Smartphone Fujitsu Arrows A 202F

▪ Thread - 8500 years

▪ Three-dimensional image on the monitor screen

▪ gene doping

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ site section Electric motors. Article selection

▪ article Facts speak for themselves. Popular expression

▪ What were the features of the emergence of the Ancient Roman state? Detailed answer

▪ article Devices on logical elements. Radio - for beginners

▪ article Satellite dish pointing indicator. Encyclopedia of radio electronics and electrical engineering

▪ article Two transformerless power supplies, 220/1,4 volts 1 milliamp. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024