TLC5615 D/A chip program

Memory chip
>INCLUDE ; contains header files
__CONFIG_DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
Debug mode is off, write protection, half ROM can be overwritten online, EEPROM encryption, low voltage programming off, power down detection off, power-on delay on, watchdog off, 4M crystal oscillator HS oscillation
VALUE1EQU0F1H; the data to be converted is 4 bits high (the high nibble is invalid data)
VALUE2EQU0FCH; the data to be converted is 6 bits low (the lowest 2 bits are invalid data)
ORG00H; program reset address
NOP; empty instructions required by ICD
MAIN
CLRFPORTC; clear all outputs first
BCFPORTC, 3; pull down the clock signal to change the chip select enable signal
BSFPORTC, 2;
BANKSELTRISC
CLRFTRISC; C port full output
BSFTRISC, 4; RC4 port input (SDI)
BANKSELSSPSTAT
MOVLWB '01000000'; CKE = 1 falling edge transmission (TCL5615 regulations)
MOVWFSSPSTAT
CLRFSTATUS
MOVLWB '00100000'; SSPEN=1, CKP=0SPI main air mode Fosc/4
MOVWFSSPCON
BCFPORTC, 3; pull down the clock signal to change the chip select enable signal
BCFPORTC, 2; chip select enable
MOVLWVALUE1; 4 bits high for the converted data
MOVWFSSPBUF; send
BTFSSPIR1, SSPIF; determine whether the transmission is complete
GOTO$-1; waiting to be sent
BCFPIR1, SSPIF; clear interrupt flag
MOVFWSSPBUF; clear receive register
MOVLWVALUE2; the lower 6 bits of the data to be sent
MOVWFSSPBUF; send
BTFSSPIR1, SSPIF; determine whether
GOTO$-1; waiting to be completed
BCFPIR1, SSPIF; clear interrupt flag
BCFPORTC, 3; pull down the clock signal
BSFPORTC, 2;
NOP
GOTO$

;************************************************* ***********
END; end of program


Fiber Optic Splice Closure

Fiber Optic Splice Closure,Fiber Optic Splice Case,Fiber Splice Closures,Outdoor Fiber Optic Splice Closure

Cixi Dani Plastic Products Co.,Ltd , https://www.dani-fiber-optic.com

Posted on