【发布时间】:2016-12-14 01:17:54
【问题描述】:
我想发送一些数据以显示在 LED 8x8 矩阵上,该矩阵上有 MAX7219 芯片。
我的 MCU 是 ARM STM32F4,我使用 MikroC 作为开发工具来编程这个外设。
我完全是这种编程方式的初学者,所以我想知道如何发送文本,即从 MCU 到 LED 矩阵。
我写了一些代码,当我打开我的 MCU 时,所有 64 个 LED 都一直在发光,我不知道为什么。
// MCU's CS/PE11 pin
sbit Chip_Select at ODR11_GPIOE_ODR_bit;
void main() {
// Set PE11 as output pin (ChipSelect pin)
GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_11);
// Initialization method from SPI library from mikroC
SPI2_Init();
while (1) {
// select led matrix
Chip_Select = 0;
// sending data to matrix
SPI2_Write(0x01FF);
// deselect led matrix
Chip_Select = 1;
Delay_ms(500);
}
}
希望任何人都可以帮助我更加熟悉这一点。
提前致谢!
【问题讨论】:
-
听起来您需要阅读该显示器的数据表。如果您只发送“打开所有 LED 灯”命令每半秒重复一次,那么所有 LED 灯都亮着也就不足为奇了……