I need help to drive a MAX7219 with ZBasic and a Wemos D1 mini (ESP8266).
Any example for driving a MAX7219 with ZBasic for ESP8266 will be appreciated.
I did the same thing with success with BASCOM-AVR and a ATtiny85 and I used only Shiftout like this very short example in BASCOM-AVR :
Code: Select all
...
loadpin Alias Portb.2 ' load pin for display driver
Ser_clk Alias Portb.1 ' clk for display driver
Ser_data Alias Portb.0 ' data for display driver
...
Disp_num = &H0C
Disp_data = &H00
Shiftout Ser_data , Ser_clk , Disp_num , 1
Shiftout Ser_data , Ser_clk , Disp_data , 1
Set loadpin
Waitms 5
Reset loadpin
...
I'm prettry sure that the connections between the Wemos D1 mini (ESP8266) and the MAX7219 are right.
Code: Select all
Const Ser_clk as Byte = A.14
Const Ser_data as Byte = A.13
Const loadpin as Byte = A.15
Dim Disp_num as Byte
Dim Disp_data as Byte
Sub Main()
Call Delay(1.0)
'setup max7219 config. registers
Disp_num = &H0C
Disp_data = &H00
Call Disp_write()
Disp_num = &H09
Disp_data = &H00
Call Disp_write()
Disp_num = &H0A
Disp_data = &H05
Call Disp_write()
Disp_num = &H0B
Disp_data = &H07
Call Disp_write()
Disp_num = &H0F
Disp_data = &H00
Call Disp_write()
Disp_num = &H0C
Disp_data = &H01
Call Disp_write()
Call Delay(1.0)
Do
'Display something in the Max7219 led matrix
Disp_num = &H01
Disp_data = &H01
Call Disp_write()
Disp_num = &H02
Disp_data = &H03
Call Disp_write()
Disp_num = &H03
Disp_data = &H07
Call Disp_write()
Disp_num = &H04
Disp_data = &H0F
Call Disp_write()
Disp_num = &H05
Disp_data = &H1F
Call Disp_write()
Disp_num = &H06
Disp_data = &H3F
Call Disp_write()
Disp_num = &H07
Disp_data = &H7F
Call Disp_write()
Disp_num = &H08
Disp_data = &HFF
Call Disp_write()
Call Delay(60.0)
Loop
End Sub
Sub Disp_write()
'Call ShiftOut(Ser_data,Ser_clk,8,Disp_num)
'Call ShiftOut(Ser_data,Ser_clk,8,Disp_data)
Call ShiftOutEx(Ser_data,Ser_clk,8,Disp_num,&H00)
Call ShiftOutEx(Ser_data,Ser_clk,8,Disp_data,&H00)
Call PutPin(loadpin,1)
Call Delay(0.1)
Call PutPin(loadpin, 0)
Call Delay(0.1)
End Sub
Am I in the right way ?
Any working example to suggest me ?
Thank's a a lot !