Art,
I ran your suggestions through a simulator and a couple of things.
1. Scrolls from Left to Right, ozarkshermit wanted Right to Left.
2. Characters are in reverse order. Should read for 20 chars on the screen "CHECK IT OUT A SCROL", but comes out "LORCS A TUO TI KCEHC"
So I took your example and modified it to change these items.
I put this together for a 18F4620.
Compiles and runs fine in the simulator.
Code:'*****PIC MCU Configuration Fuses (MPASM)***** #IF __PROCESSOR__ = "18F4620" #CONFIG CONFIG OSC = ECIO6 ; EC oscillator, port function on RA6 CONFIG WDT = OFF ; WDT disabled (control is placed on the SWDTEN bit) CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled CONFIG IESO = OFF ; Oscillator Switchover mode disabled CONFIG PWRT = OFF ; PWRT disabled CONFIG BOREN = SBORDIS ; Brown-out Reset enabled in hardware only (SBOREN is disabled) CONFIG BORV = 3 ; Minimum setting ;CONFIG WDT = ON ; WDT enabled CONFIG WDTPS = 512 ; 1:512 CONFIG CCP2MX = PORTC ; CCP2 input/output is multiplexed with RC1 CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset CONFIG LPT1OSC = OFF ; Timer1 configured for higher power operation CONFIG MCLRE = ON ; MCLR pin enabled; RE3 input pin disabled CONFIG STVREN = ON ; Stack full/underflow will cause Reset CONFIG LVP = OFF ; Single-Supply ICSP disabled CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode) CONFIG DEBUG = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins CONFIG CP0 = OFF ; Block 0 (000800-003FFFh) not code-protected CONFIG CP1 = OFF ; Block 1 (004000-007FFFh) not code-protected CONFIG CP2 = OFF ; Block 2 (008000-00BFFFh) not code-protected CONFIG CP3 = OFF ; Block 3 (00C000-00FFFFh) not code-protected CONFIG CPB = OFF ; Boot block (000000-0007FFh) not code-protected CONFIG CPD = OFF ; Data EEPROM not code-protected CONFIG WRT0 = OFF ; Block 0 (000800-003FFFh) not write-protected CONFIG WRT1 = OFF ; Block 1 (004000-007FFFh) not write-protected CONFIG WRT2 = OFF ; Block 2 (008000-00BFFFh) not write-protected CONFIG WRT3 = OFF ; Block 3 (00C000-00FFFFh) not write-protected CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected CONFIG WRTB = OFF ; Boot Block (000000-0007FFh) not write-protected CONFIG WRTD = OFF ; Data EEPROM not write-protected CONFIG EBTR0 = OFF ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks CONFIG EBTR1 = OFF ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks CONFIG EBTR2 = OFF ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks CONFIG EBTR3 = OFF ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks CONFIG EBTRB = OFF ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks #ENDCONFIG #else #ERROR "This program requires a PIC 18F4620 MCU" #endif OSCCON = $60 ' Set PIC to 4Mhz & ECIO Clock Mode '*****END PIC Configuration***** '*****Defines***** define OSC 4 ' Set clock to 4Mhz in PIC Basic '*****Define LCD registers and bits***** define LCD_BITS 4 define LCD_LINES 2 Define LCD_DREG PORTD Define LCD_DBIT 4 Define LCD_RSREG PORTE Define LCD_RSBIT 0 Define LCD_EREG PORTE Define LCD_EBIT 1 define LCD_RWREG PORTE define LCD_RWBIT 2 define LCD_COMMANDUS 1500 define LCD_DATAUS 44 '*****END Defines***** ADCON0.0 = 0 ' A/D Converter module is disabled ADCON1 = $0F ' %0000 1111 AN2=VSS, AN3=VDD, AN12-0 = Digital ADCON2 = $00 ' %0000 0000 TRISA = 0 TRISB = 0 TRISC = 0 TRISD = 0 TRISE = 0 string var byte[20] ' because I assume it’s one line of a 2x20 display but you can change this character var byte ' the current character counter var byte ' a step counter and index lindex var byte ' a lookup table index ' Initialize LCD Low PORTE.2 ' LCD R/W low = write Pause 100 ' Wait for LCD to startup LCDOUT $fe,1,"Startup" pause 1000 start: lindex = 0 lcdout $fe,1 'CLEARLCD it’s been a while since I looked at LCDOUT, but whatever two byte code to clear LCD and home. cycle: lcdout $fe, $02 'HOMELCD it’s been a while since I looked at LCDOUT, but whatever two byte code to home LCD cursor. gosub lookuptable lindex = lindex + 1 ' increment lookup index if lindex > 37 then ' limit lookup index to length of message lindex = 0 endif gosub rotatearray ' rotate line with new character at zero index for counter = 0 to 19 ' print the line to lcd LCDOUT string[counter] next counter pause 1000 ' delay to see one movement per second goto cycle ' do cycle forever lookuptable: ' get the next character from the table into the character buffer LOOKUP lindex,["CHECK IT OUT A SCROLLING TEXT DEMO!!! "],character ' 0-37 length message (38 characters in Human talk) return rotatearray: ' rotate line array for counter = 0 to 18 step 1 string[counter] = string[counter+1] next counter string[19] = character return




Bookmarks