I would like to send some data to display it on LED 8x8 matrix which has MAX7219 chip on it.
My MCU is ARM STM32F4 and I'm using MikroC as develop tool to program this peripheral.
I am total beginner to this way of programming, so I would like to know how is sending text i.e. done from MCU to LED matrix.
I've wrote some code, and when I turn on my MCU all 64 LEDs are shining constantly, I don't have idea why.
// 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);
}
}
Hope anyone could help me get more familiar with this.
Thanks in advance!
MAX7219 must be initialized before use. I forgot that, so this is my working code: