إضافة نص مع تسليط الضوء على الحرف الأول عن طريق وميضه :
البرنامج بعد الإضافة :
كود:
; LCD-Scrolling-flashing-Message-16F628A
Device 16F628A ;PIC type : Any type capable of driving LCD
Xtal 4
All_Digital=TRUE ;All I/O as digital non ADC or non Comparator
;I will use default connections as in circuit diagram
;*** Define variables ***
Dim Message_array[16] As Byte ;16 elements = LENGTH OF LCD = 16 characters
Dim Datum As Byte ;data is special word so :Datum = data storage
Dim C As Byte ;Just as loop Counter
;************************************************************************************
Dim Flash_array[20] As Byte 'flash array
Dim X As Bit ' flash flag
;************************************************************************************
;*** Alias Constant ***
Symbol SPEED = 200 ; Scroll speed
Symbol LCD_LENGTH = 15 ; We are using 2x16 LCD (in this case 0-15)
DelayMS 500 ; Wait LCD to stabilized
Cls ; Clear Screen
; *** Here is your message ***
DATA "0123456789ABCDEFGHJKILMNO..... " ; Store in code memory
START:
C=0 ; Clear pointer
Repeat ; Do a loop
Message_array[C]=" " ; Clear array , 16 position
Inc C ; Increment pointer
Until C=LCD_LENGTH ; Finish the job
LOOP:
Restore ; Point to the first character of DATA table
While 1=1 ; Make an endless loop
READ Datum ; Get the first character ..ans so on ..store in Datum
Message_array[15]=Datum ; Save first character to last position of the array
GoSub SCROLL_MESSAGE ; Go to Print & Shift then Return back here to get next character
Wend ; END OF STATEMENT
SCROLL_MESSAGE:
GoSub FLASH '
Print At 1,1,Str Message_array ' Display the message
Print At 2,1,Str Flash_array '
DelayMS SPEED ' Wait
For C=0 To LCD_LENGTH-1 ' Make a loop for shifting one character to left
Message_array[C] = Message_array[C+1] ' Shift left the bytes contents : C0=C1,C1=C2,C2=C3,..C14=C15
Next ' Finish the job
Return ' Back
'----FLASH MESSAGE----
FLASH:
If X=0 Then
Str Flash_array=" " ; clear first character only to flash
X=1
Return
EndIf
If X=1 Then
Str Flash_array="PROTON IDE 2009"
X=0
Return
EndIf
End