> Still again asking: should i change something related to PIC16F628A?
If I don't know the answer to questions like will my program work on a 16F628 as well as a 16F628A... I would...
1. Download both Datasheets and compare them...
2. Create a simple program to display "I must learn to study Datasheets" on my LCD and compile it for a standard 16F628. I would then burn an 'A' version with that code and checked if it would still work.
But that's me... you on the other hand would rather ask the same questions over and again on the forum... hint... if you tried option 2, you'd discover the answer in less than 15 minutes...
Even Drugs and Chemicals have Datasheets - and you would use one of those without checking the Datasheet first?
Code:
'
' Device Programming Options
' --------------------------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection
'
' Hardware Defines
' ----------------
'
' LCD Display
' -----------
Define LCD_DREG PORTB ' Port for LCD Data
Define LCD_DBIT 4 ' Use upper 4 bits of Port
Define LCD_RSREG PORTB ' Port for RegisterSelect (RS) bit
Define LCD_RSBIT 3 ' Port Pin for RS bit
Define LCD_EREG PORTB ' Port for Enable (E) bit
Define LCD_EBIT 2 ' Port Pin for E bit
Define LCB_BITS 4 ' Using 4-bit bus
Define LCD_LINES 2 ' Using 2 line Display
Define LCD_COMMANDUS 2000 ' Command Delay (uS)
Define LCD_DATAUS 50 ' Data Delay (uS)
'
' Software Defines
' ----------------
CounterA var BYTE
CounterB var BYTE
CounterC var BYTE
DataA var BYTE
'
' EEPROM Contents
' ---------------
Data @0,"I must learn not to be lazy and to read Datasheets!"
'
' Initialise PIC
' --------------
TRISA=%00000000 ' PortA all OUTPUT
TRISB=%00000000 ' PortB all OUTPUT
CMCON=%00000111 ' Comparators OFF
'
' Main Program
' ------------
Pause 2000 ' Timeout for LCD Hardware to wake-up...
LCDOut $FE,1 ' Clear Display
Loop:
For CounterA=0 to 35
Gosub DisplayMessage
Next CounterA
Pause 1000
For CounterA=35 to 0 step -1
Gosub DisplayMessage
Next CounterA
Pause 1000
Goto Loop
'
' Subroutine Displays Scrolling Message
' -------------------------------------
DisplayMessage:
LCDOut $FE,$80
For CounterB=0 to 16
CounterC=CounterA+CounterB
Read CounterC,DataA
LCDOut DataA
Next CounterB
Pause 500
Return
End
If the above doesn’t work for you, then there are still career openings in Landscape Gardening…
Bookmarks