cucamunga said:
Can anyone give me an example of how do this?
Here is a proton basic example ripped straight from some code I used to read analog data from an accelerometer...
===================================================
Device=16F676 'define processor
Set OSCCAL
Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, BODEN_OFF
' internal 4mhz osc, MCLR internal, watchdog timer off, brown out off '-
'--------------------------------------------------------------
' setup ports -
TRISA = %00000001 'port a.0 = AD input
TRISC = %00000000 ' define port pin assignments
ADCON0 = %10000001 ' make reference voltage = VDD
ADCON1 = %01110000 ' Make AN0 analog input,
ANSEL = %00000001
CMCON = %00000111
'--------------------------------------
ADIN_RES = 10 '10 bit ad conversion
'ADIN_TAD = frc ' internal RC osc
ADIN_STIME = 100 ' AD sample time 100us
'--------------------------------------
'this bit sets up 4 wire LCD on PORTC
Declare LCD_INTERFACE 4
Declare LCD_DTPIN PORTC.0
Declare LCD_LINES 2
Declare LCD_ENPIN PORTC.4
Declare LCD_RSPIN PORTC.5
'connect R/W pin to ground!!
====================================================
The above code defines the pic, sets the relevant fuses, configures the registers, sets up the A/D resolution and sample time and sets up portC to use a 4 wire parallel LCD... Simple stuff!!!