
 Originally Posted by 
lerameur
					
				 
				I think my problem might be the sending code. I have added the output line to my lcd tosee what is sending, it says it is sending V 
and I's..
-----------------because a V is ASCII code $56? and the 'I' must be a special character or something-doesn't matter
---------------------
here is the sending code
 define osc 20
 Include "modedefs.bas"
------------------get rid of this unless you are really using a bootloader
Define	LOADER_USED	1
-----------------------------------------------------------
DEFINE LCD_DREG PORTB	' Set LCD Data port
DEFINE LCD_DBIT 4	' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB	' Set LCD Register Select port
DEFINE LCD_RSBIT 1	' Set LCD Register Select bit
DEFINE LCD_EREG PORTB	' Set LCD Enable port
DEFINE LCD_EBIT 0	' Set LCD Enable bit
DEFINE LCD_BITS 4	' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2	' Set number of lines on LCD 
CMCON=7              ' Disable comparators
ANSEL=0               ' Set port as digital I/O
ADCON1=7
TrisA = %11111111  'sets all port a as input
TrisB = %00000000  ' sets all port b as output
X VAR BYTE 'VARIABLE TO PUT POT VALUE
B1 VAR BYTE
PORTB = 0 'ALL OUTPUTS LOW
'23
Start:
Pot PortA.2,49,X           ' would like PortA.2,175,B0 use number to suit you
Lcdout $fe, 1                   'Clear screen
Lcdout $FE,$80,"Pot: ", #X       'Display the numerical value
------------------------------should be 'HEX B1' at the end
LCDOUT $FE,$C0,"Output: ",B1
-------------------------------
Pause 10 
IF  X <= 60 THEN LED1
IF (X > 60) AND (X <= 120) THEN LED2
IF (X > 120) AND (X <= 180) THEN LED1
IF X > 180  THEN LED2
goto Start
LED1
serout portb.2,n2400, [ $AA, $AA,$AA,$AA,$AA,$AA ]
B1=$AA
goto Start
LED2
serout portb.2, n2400, [ $56,$56,$56,$56,$56 ]
B1=$56
goto Start
LED3
serout portb.2,n2400, [ $55,$55,$55,$55,$55 ]
B1=$55
goto Start
LED4
serout portb.2,n2400, [ $65,$65,$65,$65,$65,$65 ]
B1=$65
goto Start
end
			
		 
	
Bookmarks