hello...got thing want to ask u all de.....now i using the KC-21 bluetooth module to connect with the pic 16F877A and now i facing the problem is why my pic tx out the data to my kc-21 bluetooth cant tx to the receiver part and the receiver part i also using the kc21 bluetooth module with max232 and the hyperterminal there cant receiver the data from my tx there...what the happen...below is my programming souce code....hope u all can help me....!!! thanks.......a lot...!!!!
Define LCD_DREG PORTB
Define LCD_DBIT 4
Define LCD_RSREG PORTB
Define LCD_RSBIT 0
Define LCD_EREG PORTB
Define LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
DEFINE OSC 4 ' We're using a 4 MHz oscillator
DEFINE ADC_BITS 8 ' Set A/D for 8-bit operation
DEFINE ADC_CLOCK 1 ' Set A/D clock Fosc/8
DEFINE ADC_SAMPLEUS 50 ' Set A/D sampling time @ 50 uS
DEFINE debug_mode 0 ' Debug sending True serial data
DEFINE debug_reg Portc ' Debug Port = PortC
DEFINE debug_bit 6 ' Debug.bit = PortC.6
DEFINE debug_baud 9600 ' Default baud rate = 9600
define loader_user 1
include "modedefs.bas"
pause 2000
LCDOUT 254,1, " WELCOME MY "
LCDOUT 254,192,20,"MONITOR SYSTEM"
samples VAR WORD ' Multiple A/D sample accumulator
sample VAR BYTE ' Holds number of samples to take
temp VAR BYTE ' Temperature storage
samples = 0 ' Clear samples accumulator on power-up
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %00000011 ' Set PORTA.0,1,2,5 = A/D, PortA.5 = +Vref
PAUSE 500 ' Wait .5 second
loop:
FOR sample = 1 TO 20 ' Take 20 samples
ADCIN 0, temp ' Read channel 0 into temp variable
samples = samples + temp ' Accumulate 20 samples
PAUSE 250 ' Wait approximately 1/4 seconds per loop 250
NEXT sample
temp = samples/20
LCDOUT $FE, 1 ' Clear LCD
LCDOUT "My Temp: ",DEC temp,"'C"
serout Portc.6,N9600,[#temp]
pause 5000
If temp >= 80 then Alarm
if temp <= 20 then Alarm1
high portd.0
samples = 0 ' Clear old sample accumulator
GOTO loop ' Do it forever
end
Bookmarks