Most Nanos - at least the clone ones - use the old (57600 baud) bootloader. You can update the firmware from the Arduino IDE - although you will need a programmer to do this - I've done this with several boards and not had a problem uploading at 115200...
Martin
MAX7219 DOT MATRIX 8 x 8 Pixels
-
- Valued Contributor
- Posts: 1453
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: MAX7219 DOT MATRIX 8 x 8 Pixels
It is so:
- Attachments
-
- Nano_Max-2.fcfx
- (8.13 KiB) Downloaded 568 times
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: MAX7219 DOT MATRIX 8 x 8 Pixels
You need to call - Shutdown(false) - to turn the display - see my previous comment about the wisdom (or otherwise) of this design choice..
Martin
Martin
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: MAX7219 DOT MATRIX 8 x 8 Pixels
Okay I tweaked your code very slightly - I added an output to pin10 and adjusted swap X and swap Y to suit my display (note - these reflect the orientation of the individual 8 x 8 grids - so swapX particularly might not have the affect you think it would)
I changed to a scrolling string - rather than a digit - DisplayDigit is used for the 8 digit (numeric displays) - displays are 0..3 not 1..4
I also changed and used a Uno (I've swapped back for upload - but you might need to reset the programmer port..)
And - working nicely - Hello world scrolling across!
Note - I also changed the prescaler to FOsc/8 - but this is not necessary, if you have reasonable wiring the displays will work at FOsc/2
Try Demo (n) (n = 0..10) to see some of the effects....
I changed to a scrolling string - rather than a digit - DisplayDigit is used for the 8 digit (numeric displays) - displays are 0..3 not 1..4
I also changed and used a Uno (I've swapped back for upload - but you might need to reset the programmer port..)
And - working nicely - Hello world scrolling across!
Note - I also changed the prescaler to FOsc/8 - but this is not necessary, if you have reasonable wiring the displays will work at FOsc/2
Try Demo (n) (n = 0..10) to see some of the effects....
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: MAX7219 DOT MATRIX 8 x 8 Pixels
Sergejs requested some documentation... So here is a brief description of the MAX7219 routines
Max7219 component
The MAX7219 component is mainly intended to work with 8 x 8 LED arrays using the MAX7219 as a controller. It also allow control of the numeric 8 segment displays.
Connecting the display. The displays (up to 16 can be chained together) have 5 connections. Three to the MCU and power and ground (ground must be common to the display and MCU). Multiple displays can pull quite a large current so are best powered by a 'separate' power supply to the MCU.
The pins are set in the component 'properties' panel CLK, MOSI (may be marked DIN or DI on display) and Chip Select (CS)
SwapY and SwapY refer to the orientation of the individual displays.
Normal is
0 → 7 0 -> 7 for X and
0 → 7 for Y
Setting SwapX to true means the displays have co-ordinates of
7 → 0 7 → 0 and SwapY true gives
7 → 0 for Y
Rotated may be set to 0 or 1 and sets the orientation of the displays from left to right to vertical.
Set the number of devices to reflect the number of 8 x 8 displays attached.
In use:
Call InitialiseLED() → this Initialises the LED component, clearing the display and setting it to 'off' (Call Shutdown(false) to turn the display on)
SetIntensity(n) → sets the brightness of the display from 0 (off) to 15 (max brightness)
ClearDisplays() → Clears all the displays
Demo(n) → where n = 0..10 showcases some of the routines supported
DispTextLine(str, x, y, r) → Displays a single pixel row (r) of a string (str) at x, y. This is used to 'slide' in text (for example it is used in Slew)
DisplayStr(addr, str, clear) → Draws a string to grid boundaries (so first display = 0) (clear is ignored)
FadeIn(s, step, delay) → 'Fades' in a string s with step between pixels and delay ms between each step
Invert(flashes, delay) → Flashes the display (swaps on and off LEDs) for flashes swaps with delay ms between swaps. Note that if number of flashes is odd the display will be left inverted.
Pen(device, char) → writes a single character to an individual 8x8 display
PenRot(device, char, rot) → writes a 'rotated' character to an individual display
Plot(x, y, set) → sets or clears a 'pixel' at x, y where the displays are treated as a 0..8 x displays – 1 by 8 grid.
PlotRotate(x, y, r, set) → Sets or clears a pixel with rotation
Scroll(direction) → Scrolls the display left, right, up or down
ScrollStr(str, dir, delay) → scrolls a string (str) onto the display from the left or right. Stops when the string is completely displayed). Setting the delay to a smaller number gives a faster scroll,
ScrollStr3(str, delay) → Scrolls a string across where each individual display is rotated at 90degrees
Shutdown(powrOff) → turns off the display
Slew(str, d, pause, invert) → Slews a string in by pixel rows - d is number of pixels 'delay' between rows, pause is number of ms to wait between loops. Invert flips the string vertically.
Max7219 component
The MAX7219 component is mainly intended to work with 8 x 8 LED arrays using the MAX7219 as a controller. It also allow control of the numeric 8 segment displays.
Connecting the display. The displays (up to 16 can be chained together) have 5 connections. Three to the MCU and power and ground (ground must be common to the display and MCU). Multiple displays can pull quite a large current so are best powered by a 'separate' power supply to the MCU.
The pins are set in the component 'properties' panel CLK, MOSI (may be marked DIN or DI on display) and Chip Select (CS)
SwapY and SwapY refer to the orientation of the individual displays.
Normal is
0 → 7 0 -> 7 for X and
0 → 7 for Y
Setting SwapX to true means the displays have co-ordinates of
7 → 0 7 → 0 and SwapY true gives
7 → 0 for Y
Rotated may be set to 0 or 1 and sets the orientation of the displays from left to right to vertical.
Set the number of devices to reflect the number of 8 x 8 displays attached.
In use:
Call InitialiseLED() → this Initialises the LED component, clearing the display and setting it to 'off' (Call Shutdown(false) to turn the display on)
SetIntensity(n) → sets the brightness of the display from 0 (off) to 15 (max brightness)
ClearDisplays() → Clears all the displays
Demo(n) → where n = 0..10 showcases some of the routines supported
DispTextLine(str, x, y, r) → Displays a single pixel row (r) of a string (str) at x, y. This is used to 'slide' in text (for example it is used in Slew)
DisplayStr(addr, str, clear) → Draws a string to grid boundaries (so first display = 0) (clear is ignored)
FadeIn(s, step, delay) → 'Fades' in a string s with step between pixels and delay ms between each step
Invert(flashes, delay) → Flashes the display (swaps on and off LEDs) for flashes swaps with delay ms between swaps. Note that if number of flashes is odd the display will be left inverted.
Pen(device, char) → writes a single character to an individual 8x8 display
PenRot(device, char, rot) → writes a 'rotated' character to an individual display
Plot(x, y, set) → sets or clears a 'pixel' at x, y where the displays are treated as a 0..8 x displays – 1 by 8 grid.
PlotRotate(x, y, r, set) → Sets or clears a pixel with rotation
Scroll(direction) → Scrolls the display left, right, up or down
ScrollStr(str, dir, delay) → scrolls a string (str) onto the display from the left or right. Stops when the string is completely displayed). Setting the delay to a smaller number gives a faster scroll,
ScrollStr3(str, delay) → Scrolls a string across where each individual display is rotated at 90degrees
Shutdown(powrOff) → turns off the display
Slew(str, d, pause, invert) → Slews a string in by pixel rows - d is number of pixels 'delay' between rows, pause is number of ms to wait between loops. Invert flips the string vertically.