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:
Code:' ' 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




Bookmarks