Simple transplantation of printf function of msp430

Publisher:糖三角Latest update time:2018-05-31 Source: eefocusKeywords:msp430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I am working on a project based on TCS34725 RGB color sensor. The main control I use is MSP430. When debugging, I use 485 bus to send to the upper computer (computer or upper host computer). At first, I used the serial port sending function to send directly, but it was super inconvenient to display a lot of data, such as floating point numbers and data streams with special formats. Previously, I used the serial port sending function to group a function by calling the int putchar (char *) function. So I spent a few minutes writing a putchar function, which has been used and really succeeded... Thinking about the stupid way of constructing formats one by one and converting numbers into strings before, now I can finally use the printf function...

int putchar(int ch)
{    if (ch == '\n')       
    {
        RS485Send_Byte(0x0d) ; 
    }
    RS485Send_Byte(ch); //Send data from the serial port  
    return (ch);
}


Keywords:msp430 Reference address:Simple transplantation of printf function of msp430

Previous article:IAR development environment uses serial printf output (based on STM8L15x series microcontroller)
Next article:iar for stm8 beginner summary

Recommended ReadingLatest update time:2024-11-24 21:35

Logic interface technology of low power MSP430 microcontroller in 3V and 5V mixed system
The MSP430 ultra-low power microprocessor is a new type of single-chip microcomputer launched by TI. It has a 16-bit streamlined instruction structure, contains a 12-bit fast ADC/Slope ADC, contains 60K bytes of FLASH ROM, 2K bytes of RAM, and has rich on-chip resources, including ADC, PWM, several TIME, serial port,
[Microcontroller]
Logic interface technology of low power MSP430 microcontroller in 3V and 5V mixed system
MSP430: PWM Generation
#define     PWM                      BIT6 //  Description: This program generates one PWM output on P1.2 or P1.6 using //  Timer_A configured for up mode. The value in CCR0, 25-1, defines the PWM //  period and the value in CCR1 the PWM duty cycles. //  A 50% duty cycle on P1.6. //  ACLK = na, SMCLK = MCLK = TACLK = d
[Microcontroller]
MSP430: PWM Generation
Application of MSP430F in ETC of highway non-stop toll collection system
       TI's MSP430 microcontroller product series has a 16-bit RSIC architecture and ultra-low power consumption. As the latest product series of MSP430, F5xxx uses 0.18um process for the first time, and the current consumed by 1MIPs is as low as an astonishing 160uA, and the main frequency reaches 25MIPs. At the same
[Microcontroller]
Application of MSP430F in ETC of highway non-stop toll collection system
Problems encountered during the migration from ucos2 to msp430
1. main.c and other files cannot be linked.   All files must be in one folder. 2. ostimedly() function   is a delay function. During the delay period, this task is suspended, and the CPU executes other ready tasks with the highest priority. When the delay is over, it is added to the ready task queue, and the task wi
[Microcontroller]
MSP430: Serial Output
initialization  1 void Uart_Init(void)  2 {  3       BCSCTL1 = CALBC1_1MHZ;                    // Set DCO  4       DCOCTL = CALDCO_1MHZ;  5       P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD  6       P1SEL2 = BIT1 + BIT2 ;                    // P1.1 = RXD, P1.2=TXD  7       UCA0CTL1 |= UCSSEL_2
[Microcontroller]
MSP430 Study Notes 6- Dynamic Digital Tube Display
I rewrote the main part of this program. The program uses the watchdog as a normal timer and scans the digital tubes in the watchdog interrupt. In addition, I added a display buffer. If you want to display a number on the digital tube, you only need to operate the value in the buffer array. Finally, I added the decima
[Microcontroller]
High Power Factor Power Supply Based on MSP430
In the operation of the power grid, the power factor reflects the degree to which the apparent power output of the power supply is effectively utilized. We hope that the power factor is as large as possible. In this way, the reactive power in the circuit can be reduced to a minimum, and most of the apparent power wi
[Microcontroller]
High Power Factor Power Supply Based on MSP430
Design of ultrasonic heat meter based on MSP430FW42X single chip microcomputer
1 System principle and structure of heat meter 1.1 Basic principle of heat meter Working principle of heat meter: heat meter is installed in the heat exchange system, and paired temperature sensors are installed on the heat exchange inlet and outlet pipes respectively. When water flows through the system, the flow se
[Microcontroller]
Design of ultrasonic heat meter based on MSP430FW42X single chip microcomputer
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号