Hi again every one :P
I have a problem i want the LCD to show 0 to 255 and not 255 to 0. In other words when the pot is on left side ( lowest ohm) it will show 0 on lcd and when its on highest it show 255 on screen. Right now it do the other way.
Here is the code any suggestions?
Code:'**************************************************************** '* Name : UNTITLED.BAS * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 2007-11-30 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** Define LOADER_USED 1 Define LCD_DREG PORTD Define LCD_DBIT 4 Define LCD_RSREG PORTE Define LCD_RSBIT 0 Define LCD_EREG PORTE Define LCD_EBIT 1 ' 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 ad1 var byte ad2 var byte ' Create adval to store result ad3 var byte ad4 Var Byte TRISA = :%11111111 ' Set PORTA to all input ADCON1 = %00000010 ' Set PORTA analog Low PORTE.2 ' LCD R/W line low (W) 'Pause 500 ' Wait .5 second main: ADCIN 0, ad1 ' Read channel 0 to adval ADCIN 1, ad2 ' Read channel 1 to adval ADCIN 3, ad3 ' Read channel 3 to adval PWM portc.4 ,ad1,1' Send a 50% duty cycle PWM signal out Pin7 for 100 cycles PWM portc.5 ,ad2,1' Send a 50% duty cycle PWM signal out Pin7 for 100 cycles LCDout $fe, 1 LCDOUT "nacke:", #ad1 LCDOUT $FE, $C0, "rygg:", #ad2 Symbol delay = ad4 ' use b0 as the delay variable delay = ad2 ' set the delay to 25 ms loop: high portD.0 ' turn on Q1 pause ad4 ' wait 25 ms low portD.0 ' turn off Q1 high portD.1 ' turn on Q2 pause ad4 ' wait 25 ms low portD.1 ' turn off Q2 high portD.2 ' turn on Q3 pause ad4 ' wait 25 ms low portD.2 ' turn off Q3 high portD.3 ' turn on Q4 pause ad4 ' wait 25 ms low portD.3 ' turn off Q4 Goto main ' Do it forever End End


and post a update then.


Bookmarks