Hi,
I discovered a new problem which I never seen or heard of before. My circuit works fine with the LCD hooked up. I removed the LCD restart and the pins output goes haywire..
I removed all the coding concerning the LCD in the program, did not work. Turns out, if I do not have 56 ohm resistance between the positive and negative, the circuit will not function properly. This resistance also need to be placed on the MCLR / ground rail !!!
here is the code I have, but I am not sure this will make a difference because the code does work with the 56ohm resistance..
Code:
'using a pic16F88 - on cart trial module.
' MPASM Header
INCLUDE "modedefs.bas"
OSCCON = %01110000 '8 Mhz
Define OSC 8
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
' Define ADCIN parameters
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
ADCON1 = %00000010 'for 8 bit
value var word : variable var word : i var byte
'TRISA = %00000000 ' Set PORTA to all output
TRISB = %10000000
PORTB.1 =0
PORTB.2 =0
PORTB.3 =0
PORTB.4 =0
mainloop:
ADCON0.2 = 1 'Start Conversion
ADCIN 6, value 'Read channel PORTB.7
pause 100
variable = 256 -value
variable = variable *14
pause 30
i=1
while i<=variable
PORTB.1 =1
PORTB.2 =1
PORTB.3 =1 'green led
PORTB.4 =0 'red led
i=i+1
pause 1000
wend
i=1
while i<=variable
PORTB.1 =0
PORTB.2 =0
PORTB.3 =0 'green led
PORTB.4 =1 'red led
i=i+1
pause 1000
wend
goto MAINloop
end
Bookmarks