将int转换为字符串以显示在lcd上,atmel studio c语言

标签 c avr atmega atmel atmelstudio

我在 atmel studio 为我的 avr atmega 32 ic 编写了一个程序。通过键盘输入 0 到 999 之间的数字。我想把它显示在液晶屏上。 我的问题是: lcd 仅采用 char 和 string.i 将输入的数字存储在 int 变量中。我怎样才能将它转换为字符串或字符。 我写了这个函数; Y是键盘输入的数字,为int:

char str;
itoa(y,str,10);
alcd_putc(str);

但这并没有什么作用。帮帮我谢谢。

最佳答案

使用alcd_puts函数如下:

char str[5]; //< Use a array of char
itoa(y,str,10);
alcd_puts(str); 

关于将int转换为字符串以显示在lcd上,atmel studio c语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57336912/

相关文章:

c - "space bar"之后扫描字符终止的问题

c - 将 char 变量类型转换为 unsigned int

c - 如果我们同时使用两个传感器,为什么它会向我们的电脑发送错误数据?

timer - 为什么Arduino在millis函数中每1.024ms使用一次中断?

driver - 需要使用 Arduino R3 作为串口转 USB 转换器的帮助(来编程)

arduino - ATMega328P "AVRDude: Could not find USBTiny Device (0x1781/0xc9f)"

c - malloc 返回内存或虚拟地址空间

c - 字符串按字母顺序排列的字符数

c - 扫描成结构

embedded - AVR 模拟比较器 + 内部上拉?