--- This is a test - only visible to admins ---
--- advertisement may go here ---
  • PicŪ Basic


  • Scrolling text on an LCD

    A simple scrolling message for the beginner. Simple commands yet powerful enough to burn your message. Message length is limited only by memory.

    PROCEDURE:

    Just change the value of the statement with "$$$ MARKED" to fit your LCD length to remove the flashing message. Just delete the statement with "Remove this line as you like"

    Enjoy

    ' A SIMPLE "MESSAGE SCROLLING" FOR BEGINNER
    ' SIMPLE COMMANDS YET POWERFUL ENOUGH TO BURN YOUR MESSAGE
    ' 28 SEPT 2004
    ' UNLIMITED MESSAGE [ MEMORY DEPENDENT(",) ]
    ' BY: Dolci
    ' PROCEDURE: JUST CHANGE THE VALUE OF THE STATEMENT WITH "$$$ MARKED" TO FIT TO YOUR LCD LENGTH
    ' TO REMOVE THE FLASH MESSAGE JUST DELETE THE STATEMENT WITH "REMOVE THIS LINE AS YOU LIKE"

    DEVICE 16F877 ' WE ARE USING...(ANY TYPE:CAPABLE OF DRIVING LCD)

    ' CHANGE CONFIG DIREVTIVES AS PER DEVICE USE
    CONFIG WDT_OFF,XT_OSC,PWRTE_ON,LVP_OFF,CP_OFF,DEBUG_OFF,W RTE_OFF,CPD_OFF,BODEN_OFF

    ALL_DIGITAL=TRUE ' COMMENT OUT IF NON ADC OR NON COMPARATOR CHIPS

    ' CHAGNGE LCD DECLARATIONS AS PER YOUR CHOICE
    DECLARE LCD_TYPE ALPHA ' Inform the compiler as to the type of LCD
    DECLARE LCD_DTPIN PORTB.4 ' Used for 4-line interface.
    DECLARE LCD_ENPIN PORTB.2 ' Assigns the Port and Pin that the LCD's EN line will attach to.
    DECLARE LCD_RSPIN PORTB.3 ' Assigns the Port and Pins that the LCD's RS line will attach to.
    DECLARE LCD_INTERFACE 4 ' 4-line or 8-line interface is required by the LCD.
    DECLARE LCD_LINES 2 ' Inform the compiler as to how many lines the LCD has

    ' *** DEFINE VARIABLES ***
    DIM MESSAGE_ARRAY[20] AS BYTE ' $$$ LENGTH OF LCD
    DIM DATUM AS BYTE ' DATA STORAGE
    DIM Y AS BYTE ' JUST A COUNTER
    DIM FLASH_ARRAY[20] AS BYTE ' "FLASH-REMOVE AS YOU LIKE"
    DIM X AS BIT ' "FLASH-REMOVE AS YOU LIKE"
    ' *** ALIAS CONSTANT ***
    SYMBOL EOM = 1 ' END OF MESSAGE
    SYMBOL SPEED = 190 ' $$$ SCROLL SPEED
    SYMBOL LCD_LENGTH = 19 ' $$$ WE ARE USING 2x20 LCD (IN THIS CASE 0-19)

    DELAYMS 500 ' WAIT LCD TO STABILIZED
    CLS ' CLEAR SCREEN

    ' *** HERE IS YOUR MESSAGE *** NOTE: No double space! (1 is the End Of Message)
    DATA "Created September 28,2004... PROTON PLUS 2.1.5 by CROWNHILL ASSOCIATES... "
    DATA "Programed by DOLCI... a_balina@hotmail.com...This e-mail address is being protected from spam bots, you need JavaScript enabled to view it kwatog217@yahoo.com...This e-mail address is being protected from spam bots, you need JavaScript enabled to view it Manila, Philippines... MEMORY DEPENDENT"
    DATA " SCROLLING MESSAGE!!!",1
    GOTO START

    '------------------------------------------------------------------------------------
    ' (REMOVE THIS LINES AS YOU LIKE)
    '----FLASH MESSAGE----
    FLASH:
    IF X=0 THEN
    STR FLASH_ARRAY=" "
    X=1
    RETURN
    ENDIF
    IF X=1 THEN
    STR FLASH_ARRAY=" PROTON PLUS V2.1.5 "
    X=0
    RETURN
    ENDIF
    -------------------------------------------------------------------------------------

    SCROLL_MESSAGE:
    GOSUB FLASH ' REMOVE THIS LINE AS YOU LIKE
    PRINT AT 1,1,STR MESSAGE_ARRAY ' DISPLAY THE MESSAGE
    PRINT AT 2,1,STR FLASH_ARRAY ' "REMOVE THIS LINE IF ANNOYING"
    DELAYMS SPEED ' WAIT
    FOR Y=0 TO LCD_LENGTH-1 ' MAKE A LOOP
    MESSAGE_ARRAY[Y] = MESSAGE_ARRAY[Y+1] ' SHIFT LEFT THE BYTES CONTENTS
    NEXT ' FINISH THE JOB
    RETURN ' BYE!

    START:
    Y=0 ' CLEAR POINTER
    REPEAT ' DO A LOOP
    MESSAGE_ARRAY[Y]=" " ' CLEAR ARRAY
    INC Y ' INCREMENT POINTER
    UNTIL Y=LCD_LENGTH ' FINISH THE JOB

    LOOP:
    RESTORE ' POINT TO FIRST CHARACTER OF DATA
    WHILE 1=1 ' MAKE AN ENDLESS LOOP
    READ DATUM ' GET THE FIRST CHARACTER... AND SO ON....
    IF DATUM=EOM THEN BLANK_TXT ' TRACK END OF MESSAGE & EXIT IF FOUND
    MESSAGE_ARRAY[19]=DATUM ' $$$ SAVE THE DATA TO LAST BYTE OF THE ARRAY
    GOSUB SCROLL_MESSAGE ' GO AND PLAY
    WEND ' END OF STATEMENT

    BLANK_TXT:
    IF MESSAGE_ARRAY[10]=" " THEN ' $$$ TRACK THE FIRST BLANK CHARACTER
    IF MESSAGE_ARRAY[11]=" " THEN ' $$$ TRACK THE SECOND BLANK CHARACTER
    GOTO LOOP ' IF FOUND? GO BACK TO LOOP
    ENDIF ' END OF 2ND STATEMENT
    ENDIF ' END OF 1ST STATEMENT
    MESSAGE_ARRAY[19]=" " ' $$$ STORE A BLACK CHARATER TO THE LAST BYTE OF THE ARRAY
    GOSUB SCROLL_MESSAGE ' GO AND FINISH THE PLAY
    GOTO BLANK_TXT ' DO IT AGAIN
    END ' END OF PROGRAM
    contributed by DOLCI.
  • Recent Activity

    teo-16018

    Frequency counter

    Thread Starter: teo

    Hello everybody Can someone help me with a piece of code to measure a frequency (1Hz to 160 Hz) precision two decimals. The result is transmitted...

    teo Today, 17:43 Go to last post
    RGV250-614

    SD routines for 18F series

    Thread Starter: charliecoultas

    I've used the SD routines very successfully for the P24 chips, but now I need to attach an SD card to a 18F26K22. Do such routines exist and if...

    RGV250 Today, 19:40 Go to last post
    towlerg-21522

    PickitPlus for Pickit2 and Pickit3 works well

    Thread Starter: leonj

    Hi Everyone, I have always had issues with Pickit2/Pickit3 and I'm glad to say they seem to all be solved now. I obtained PickitPlus from Even at...

    towlerg Today, 14:36 Go to last post