the first code works with 4mhz but not 20mhz why
and second code does not work with iether
but is suposed to display ADC value on LCD
from a thermister
do the Defines for ADC need to be changed
Thanks any help is great
--------------
' PicBasic Pro program to display "Hello World" on LCD
' Auther mel
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
DEFINE LOADER_USED 1
DEFINE OSC 4
' Define LCD registers and bits
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 4000
DEFINE LCD_DATAUS 50
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Low PORTE.2 ' LCD R/W line low (W)
Pause 500 ' Wait for LCD to start up
loop: LCDOut $fe, 1 ' Clear screen
Pause 500 ' Wait .5 second
LCDOut "Hello" ' Display "Hello"
Pause 500 ' Wait .5 second
LCDOut "world" ' Display "Hello"
Pause 500 ' Wait .5 second
GoTo loop ' Do it forever
End
-----------------------------------
' PicBasic Pro program to display result of
' 10-bit A/D conversion on LCD
'
' Connect analog input to channel-0 (RA0)
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
DEFINE LOADER_USED 1
DEFINE OSC 4
' Define LCD registers and bits
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 4000
DEFINE LCD_DATAUS 50
' Define ADCIN parameters
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 200 ' Set sampling time in uS
adval VAR WORD ' Create adval to store result
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Low PORTE.2 ' LCD R/W line low (W)
Pause 500 ' Wait .5 second
loop: ADCIN 0, adval ' Read channel 0 to adval
LCDOut $fe, 1 ' Clear LCD
LCDOut "Value: ", DEC adval ' Display the decimal value
Pause 100 ' Wait .1 second
GoTo loop ' Do it forever
End
Bookmarks