Code:
Include "LCD_D.bas" ' Defines for LCD using PORTD
INCLUDE "ADC_Default.bas" ' Defines for the ADC System
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
EEPROM 0,[14,17,17,17,17,17,17,31] ' Cust Char #0
EEPROM 8,[14,17,17,17,17,17,31,31] ' Cust Char #1
EEPROM 16,[14,17,17,17,17,31,31,31] ' Cust Char #2
EEPROM 24,[14,17,17,17,31,31,31,31] ' Cust Char #3
EEPROM 32,[14,17,17,31,31,31,31,31] ' Cust Char #4
EEPROM 40,[14,17,31,31,31,31,31,31] ' Cust Char #5
EEPROM 48,[14,31,31,31,31,31,31,31] ' Cust Char #6
CGLOAD VAR WORD : CGLOAD = 0 ' Variable for holding Character # to Load
CGLLOC VAR BYTE : CGLLOC = 0 ' LCD Location to Store Character (0 to 7)
CGLOOP VAR BYTE ' Variable for Selecting Data Bits
CGDATA VAR BYTE ' Variable to Hold Character Data
Position Var WORD : Position = 0' Animation Frame
LCDOUT $FE, 2
Pause 1000
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _Animation1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $11 ; 01=.5s, 11=1s
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
LCDOUT 0
PAUSE 500
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
Animation1:
CGLOAD = Position * 8 ' Converts your Character Selection to EEPROM Address
CGLLOC = 64 ' Converts LCD Slot to LCD Memory Address
LCDOUT $FE, CGLLOC
FOR CGLOOP = CGLOAD to (CGLOAD + 7) 'Sets 1st Memory Address to Read + Next 7
read CGLOOP, CGDATA ' Retrieve byte from EEPROM
LCDOUT CGDATA
next CGLOOP
position = position + 1
if position > 6 then position = 0
@ INT_RETURN
With some basic modifications you should be able to add up to 8 animated characters that are animated even if not being displayed onscreen. this is just an example program to simulate a battery charging icon on a LCD. feel free to let me know if you see something that can be shortened and if you can solve any of my questions at the top.
Bookmarks