My program is not outputting anything, I think it is a initilizing problem but I do not know what:
I am posting the header:
can some one help me:
' Internal Oscillation program
' A/D testing -RA.1
' LCD
'/////////////////////////
'// Define section //
'/////////////////////////
INCLUDE "modedefs.bas"
@ DEVICE pic16F88 MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
OSCCON=$60 ' use internal 4MHZ osc
ANSEL = %01000010 ' set AN1 (RA1) as analog, others to digital
ADCON1 = %00000000 ' Left justified results in 8 bits
ADCON0 = %10001001 ' Configure and turn on A/D Module
CMCON = 7 ' Disable analog comparator
'/////////////////////////
'// LCD configuration //
'/////////////////////////
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) '4 therefore put wire at 4, 5, 6 and 7 of LCD
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 2000
TRISB = %00000000 ' Set PORTB to all output
TRISA = %11111111 ' Set PORTA to all input
'///////////////////////////////////////////////
'// Variable Declaration and initialization //
'///////////////////////////////////////////////
Output_Pot var byte
OldOutput_Pot var byte
Revolution var word
counter var byte
revolution = 0
Output_Pot = 0
OldOutput_Pot = 0
counter = 0
'Get initil value
ADCON0.2 = 1 'Start Conversion
ADCIN 1, OldOutput_Pot 'analog pin 1 (RA1) get the 8 bit result
pause 50
if OldOutput_Pot > 127 then
OldOutput_Pot =1
endif
if OldOutput_Pot < 128 then
OldOutput_Pot =0
endif
Mainloop:




Bookmarks