Log in

View Full Version : Has anyone used MAX6952, MAX6953, MAX6955 With PBP?



CuriousOne
- 9th February 2017, 07:20
Hello.

Want to use any of these chips for a school project, have them on hands, but no sample code available. Maybe someone already did something with these chips?

top204
- 28th February 2017, 16:17
Here's a simple program for the Crownhill Proton compiler that scrolls a message on a MAX6952 chip, so it should be adaptable for the PIC BASIC Pro compiler.



'
' A scrolling message on a MAX6952 chip
' Written for the Proton compiler by Les Johnson
'
Device = 16F877
Declare Xtal = 8

$define CLK_Pin PORTD.2 ' Attaches to the CLK_Pin pin of the MAX6952
$define CS_Pin PORTD.1 ' Attaches to the CS_Pin pin of the MAX6952
$define DIN_Pin PORTD.0 ' Attaches to the DIM pin of the MAX6952
'
' Create some variables
'
Dim MyText[11] As Byte = "HELLO WORLD"

Dim MAX6952_bIndex As Byte
Dim MAX6952_bLoop As Byte
Dim MAX6952_bResult As Byte
Dim MAX6952_Address As Byte
Dim MAX6952_Data As Byte

'--------------------------------------------------------------------------
GoTo Main ' Jump to the main program loop

'--------------------------------------------------------------------------
' Write a byte to the MAX6952
' Input : pAddress holds the address to write
' : pData hold the value to write
' Output : None
' Notes : None
'
$define MAX6952_Write(pAddress, pData) '
MAX6952_Address = pAddress '
MAX6952_Data = pData '
GoSub _MAX6952

_MAX6952:
'
' Send the address
'
For MAX6952_bLoop = 0 To 7
If MAX6952_Address.7 = 0 Then
Clear DIN_Pin
Set CLK_Pin
Clear CLK_Pin
Else
Set DIN_Pin
Set CLK_Pin
Clear CLK_Pin
EndIf
MAX6952_Address = MAX6952_Address << 1
Next
'
' Send the byte
'
For MAX6952_bLoop = 0 To 7
If MAX6952_Data.7 = 0 Then
Clear DIN_Pin
Set CLK_Pin
Clear CLK_Pin
Else
Set DIN_Pin
Set CLK_Pin
Clear CLK_Pin
EndIf
MAX6952_Data = MAX6952_Data << 1
Next
Return

'------------------------------------------------------------------------------------
' The main program loop starts here
' A simple scroll on the LED display
'
Main:
MAX6952_bIndex = 0

High CS_Pin
Low DIN_Pin
Low CLK_Pin

Clear CS_Pin
MAX6952_Write($04, $01)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($01, $FF)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($02, $FF)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($03, $01)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($07, $00) ' Set display
Set CS_Pin

Clear CS_Pin
MAX6952_Write($20, "H")
Set CS_Pin

While
Clear CS_Pin
MAX6952_Write($20, MyText[MAX6952_bIndex])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($21,MyText[MAX6952_bIndex + 1])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($22,MyText[MAX6952_bIndex + 2])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($23,MyText[MAX6952_bIndex + 3])
Set CS_Pin
MAX6952_bIndex = MAX6952_bIndex + 1
If MAX6952_bIndex >= SizeOf(MyText) Then MAX6952_bIndex = 0

DelayMS 700
Wend

top204
- 28th February 2017, 20:51
Here's a program that is more akin to PICBASIC Pro, so it will be a lot easier to adapt from Proton. It uses the Shout command, ShiftOut in Pro, instead of bit manipulating an SPI interface:



'
' A scrolling message on a MAX6952 chip
' Written for the Proton compiler by Les Johnson
'
Device = 16F877
Declare Xtal = 8

$define CLK_Pin PORTD.2 ' Attaches to the CLK_Pin pin of the MAX6952
$define CS_Pin PORTD.1 ' Attaches to the CS_Pin pin of the MAX6952
$define DIN_Pin PORTD.0 ' Attaches to the DIM pin of the MAX6952
'
' Create some variables
'
Dim MyText[11] As Byte = "HELLO WORLD"

Dim MAX6952_bIndex As Byte

'--------------------------------------------------------------------------
' Write a byte to the MAX6952
' Input : pAddress holds the address to write
' : pData hold the value to write
' Output : None
' Notes : None
'
$define MAX6952_Write(pAddress, pData) SHOut DIN_Pin, CLK_Pin, MsbFirst, [pAddress, pData]

'------------------------------------------------------------------------------------
' The main program loop starts here
' A simple scroll on the LED display
'
Main:
MAX6952_bIndex = 0

High CS_Pin
Low DIN_Pin
Low CLK_Pin

Clear CS_Pin
MAX6952_Write($04, $01)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($01, $FF)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($02, $FF)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($03, $01)
Set CS_Pin

Clear CS_Pin
MAX6952_Write($07, $00) ' Set display
Set CS_Pin

Clear CS_Pin
MAX6952_Write($20, "H")
Set CS_Pin

While
Clear CS_Pin
MAX6952_Write($20, MyText[MAX6952_bIndex])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($21,MyText[MAX6952_bIndex + 1])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($22,MyText[MAX6952_bIndex + 2])

Set CS_Pin
Clear CS_Pin
MAX6952_Write($23,MyText[MAX6952_bIndex + 3])
Set CS_Pin
MAX6952_bIndex = MAX6952_bIndex + 1
If MAX6952_bIndex >= SizeOf(MyText) Then MAX6952_bIndex = 0

DelayMS 700
Wend