first of all, happy new year
i went to basics and checked all the peripherals-led blinkings-analog converter- lcd drive... there is no problem. at the end, i succeed to pair with pc via bluetooth. the led on hc 06 is not blinking after pairing. everything looks allright. connection settings are the same on the two side- putty and computer's comport settings.
but i can not get it back what i send from putty- no echo
so there can be 2 reason to be a failure left:
1. because of wiring between pic and bluetooth module... (in fact, i dont think so)
2. codes...
henrik, can you check out my codes?
thanks a lot...
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 21.10.2013 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE OSC 4
'asm
' __CONFIG _CONFIG1H, _OSCS_OFF_1H & _LVP_OFF_4L & _DEBUG_OFF_4L & _PWRT_ON_2L & _XT_OSC_1H & _BOR_OFF_2L & _WDT_OFF_2H
'endasm
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 5
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 6
DEFINE LCD_RWREG PORTD
DEFINE LCD_RWBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_Lines 2
'ADCON0=%01000101
'ADCON1=%10001110
'DEFINE ADC_BITS 10 'Number of bits in ADCIN result
'DEFINE ADC_CLOCK 3 'ADC clock source (rc = 3)
'DEFINE ADC_SAMPLEUS 50
DEFINE HSER_BAUD 9600
DEFINE HSER_SPBRG 25
DEFINE HSER_RCSTA 90h'%10010000
DEFINE HSER_TXSTA 24h'%00100100
DEFINE HSER_CLROERR 1
A VAR WORD
'DATAIN VAR BYTE
'DATAFLAG VAR BIT
symbol LED=PORTE.1
'RCIF VAR PIR1.5
CHAR var byte
RCIF VAR PIR1.5
TRISA.0=1
TRISC.7=1
TRISC.6=0
TRISE.1=0
'INTCON = %11000000 ' enable global and peripheral and portb change interrupts
'PIE1.5=1 'enable rx interrupt
'PIR1.5=0
LCDOUT $FE,1
LED=1:
PAUSE 2000:
LED=0
PAUSE 1000
'DATAFLAG=0
'DATAIN=0
LCDOUT $FE,1,"OPENING"
'LCDOUT $FE,$C0,"DATA: ", DEC DATAIN
pause 1000
'On Interrupt GoTo HANDLER
INIT:
HSEROUT["Program Start",10,13]
Main:
WHILE RCIF
CHAR=RCREG
HSEROUT[Char,10,13]
LCDOUT $FE,1,"DATA: ", dec Char
TOGGLE LED
WEND
GOTO Main
'Disable
'HANDLER:
'DATAIN=RCREG
'DATAFLAG=1
'PIR1.5=0
'Resume
'Enable
End
Bookmarks