NIOS II encountered in the C problem

Source: Internet
Author: User
Tags sprintf

Debugging today, there are two problems: one is that the user wants to display a value that contains positive or negative values, the first digit is only used to display the minus sign, and the other is the need to convert the received two-dimensional matrix into a thermal map.

is the C language problem, it is not swim. The first direct Baidu "use of sprintf function". In fact, as long as the "%" after the%f directly add a space, the problem solved.

The relevant content is also posted here:

the specifications for the sprintf format are shown below. The section in [] is optional. %[Specifies the parameter [identifier] [width] [. precision] Indicator If you want to output '% ' itself, use ' percent ' processing. 1. Handle the character orientation. The minus sign is treated from the back forward. 2. Fill in the blanks. 0 words means blank 0, space is the default value, indicating that the space is placed. 3. The total width of the characters. To the minimum width. 4. Accuracy. Refers to the number of floating-point digits after the decimal point.

The other is to display the two-dimensional matrix into a heat force diagram. The first is implemented using the IF else structure. Later thought, this way of realization is really inefficient, with nios run exhausted it. So a change of mind, the idea of using a mapping table to achieve the highest efficiency. A 256-color array of size 256 is created, and the color information is written in advance. The data of the two-dimensional matrix is assigned to itself by taking the value of the 256-color array as the address. The transformation of the two-dimensional matrix can be accomplished by polling it again. The rest of the time Nios will be able to concentrate on the display of things.

NIOS II encountered in the C problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.