'18F2431 INT8 DRA818U TEST 060916 1100 'Define SIMULATION_WAITMS_VALUE = 1 Define CLOCK_FREQUENCY = 8 AllDigital Define CONFIG1L = 0x00 Define CONFIG1H = 0x08 'Int osc Define CONFIG2L = 0x1e Define CONFIG2H = 0x00 Define CONFIG3L = 0x00 Define CONFIG3H = 0x83 Define CONFIG4L = 0x80 'HVP Define CONFIG4H = 0x00 Define CONFIG5L = 0x0f Define CONFIG5H = 0xc0 Define CONFIG6L = 0x0f Define CONFIG6H = 0xe0 Define CONFIG7L = 0x0f Define CONFIG7H = 0x40 Define LCD_BITS = 4 '- (default value: 4, allowed values: 4, 8) Define LCD_DREG = PORTB '- (default value: PORTB, allowed values: available port registers For the selected device) Define LCD_DBIT = 4 '- (default value: 4, allowed values: 0, 4) Define LCD_EREG = PORTB '- (default value: PORTB, allowed values: available port registers For the selected device) Define LCD_EBIT = 0 '- (default value: 2, allowed range: 0 - 7) Define LCD_RWREG = 0 '- (default value: 0, allowed values: 0, Or available port registers For the selected device) Define LCD_RWBIT = 0 '- (default value: 0, allowed range: 0 - 7) Define LCD_RSREG = PORTB '- (default value: PORTB, allowed values: available port registers For the selected device) Define LCD_RSBIT = 2 '- (default value: 3, allowed range: 0 - 7) Define LCD_COMMANDUS = 5000 '- (default value: 5000, allowed range: 100 - 65535) Define LCD_DATAUS = 100 '- (default value: 100, allowed range: 50 - 255) Define LCD_INITMS = 100 '- (default value: 100, allowed range: 2 - 65535) Define LCD_LINES = 4 '- (default value: 2, allowed values: 1, 2, 4) Define LCD_CHARS = 16 '- (default value: 16, allowed values: 8, 16, 20, 24, 40) Define LCD_READ_BUSY_FLAG = 1 '- (default value: 0, allowed values: 0, 1) Define STRING_MAX_LENGTH = 46 Dim setgroupstr As String '''''' * 46 'String to send completed data through UART to RS232 convertor to the DRA818V Disable High Disable Low T1CON = %00000000 T2CON = 0 OSCCON = %01111100 '20MHz INTCON = %01010000 'INT0 PB.0 INTCON2 = %10000000 INTCON3 = %00000000 PIR1 = 0 PIR2 = 0 PIE1 = 0 PIE2 = 0 IPR1 = 0 IPR2 = 0 RCON.IPEN = 1 TRISA = %00000000 TRISB = %00000000 TRISC = %00001000 'IN 3 RST 'PORTA.0 = 'PORTA.1 = 'PORTA.2 = 'PORTA.3 = 'PORTA.4 = 'PORTA.5 = 'PORTA.6 = 'PORTA.7 = 'PORTB.0 = LCD E 'PORTB.1 = 'PORTB.2 = LCD RS 'PORTB.3 = 'PORTB.4 = LCD DATA 'PORTB.5 = LCD DATA 'PORTB.6 = LCD DATA 'PORTB.7 = LCD DATA 'PORTC.0 = 'PORTC.1 = 'PORTC.2 = 'PORTC.3 = 'PORTC.4 = LED 'PORTC.5 = 'PORTC.6 = 'PORTC.7 = 'PORTE.3 =MCLR PORTB = 0 LATB = 0 Symbol led = PORTC.4 led = 1 WaitMs 500 led = 0 WaitMs 500 led = 1 WaitMs 500 led = 0 WaitMs 500 ADCON0 = %00000001 '0x01 'porta digital ADCON1 = %00001110 ADCON2 = %10100100 'ADCON2 = %10100001 ADCHS = %00000000 'A/D Channels select ANSEL0 = %00000001 'Analogue select Register 0 OSCCON = %01110010 'internal 8Mhz clock 'Disable High 'WaitUs 100 Lcdinit Hseropen 9600 setgroupstr = "AT+DMOCONNECT " 'Initial value of the string Hserout setgroupstr 'Sending string to DRA818V Lcdout "AT+DMOCONNECT " Lcdout setgroupstr 'Show values on a display idle_loop: Goto idle_loop End