Hello
I am interfacing pic18f23k22 with HC05 bluetooth module through uart interface.if i send 'a' from bluetooth terminal app led must glow on and send some ok msg back to controller and if i press 'b' then led must off and send response back to pc.i have completed coding but i am not getting expected output so please help me to resolve this problem.i have also done hc05 setting through command mode.i am sharing my code please help me
//config file//
#include <xc.h>
/// CONFIG1H
#pragma config PLLCFG = ON // 4X PLL Enable->Oscillator multiplied by 4
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit->Fail-Safe Clock Monitor disabled
#pragma config PRICLKEN = ON // Primary clock enable bit->Primary clock enabled
#pragma config FOSC = INTIO67 // Oscillator Selection bits->Internal oscillator block
#pragma config IESO = OFF // Internal/External Oscillator Switchover bit->Oscillator Switchover mode disabled
// CONFIG2L
#pragma config PWRTEN = OFF // Power-up Timer Enable bit->Power up timer disabled
#pragma config BOREN = OFF //SBORDIS // Brown-out Reset Enable bits->Brown-out Reset enabled in hardware only (SBOREN is disabled)
#pragma config BORV = 190 //3 // Brown Out Reset Voltage bits->VBOR set to 1.90 V nominal
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits->1:32768
#pragma config WDTEN = OFF // Watchdog Timer Enable bits->Watch dog timer is always disabled. SWDTEN has no effect.
// CONFIG3H
#pragma config CCP2MX = PORTC1 // CCP2 MUX bit->CCP2 input/output is multiplexed with RC1
#pragma config P2BMX = PORTB5 // ECCP2 B output mux bit->P2B is on RB5
#pragma config MCLRE = EXTMCLR // MCLR Pin Enable bit->MCLR pin enabled, RE3 input pin disabled
#pragma config CCP3MX = PORTB5 // P3A/CCP3 Mux bit->P3A/CCP3 input/output is multiplexed with RB5
#pragma config T3CMX = PORTC0 // Timer3 Clock input mux bit->T3CKI is on RC0
#pragma config PBADEN = OFF // PORTB A/D Enable bit->PORTB<5:0> pins are configured as digital I/O on Reset
#pragma config HFOFST = ON // HFINTOSC Fast Start-up->HFINTOSC output and ready status are not delayed by the oscillator stable status
// CONFIG4L
#pragma config XINST = OFF // Extended Instruction Set Enable bit->Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
#pragma config LVP = ON // Single-Supply ICSP Enable bit->Single-Supply ICSP enabled if MCLRE is also 1
#pragma config STVREN = OFF //ON // Stack Full/Underflow Reset Enable bit->Stack full/underflow will not cause Reset
#pragma config DEBUG = OFF // Background Debug->Disabled
#define _XTAL_FREQ 16000000
//main.c //
- when i am sending a or b my isr must execute but my execution dont go to isr also another thing is if i am sending char 'A' in while loop in main function to bluetooth module ,i am getting some dummy data continuously .i have checked this code serially using DB9 cable but for bluetooth module it is not working
i checked configuration but now new problem arrises ,my hc05 is not detected in my android app also i checked using another 2 mobiles but hc05 is not detected why?
Great. Always check configuration of addtional devices when you conenct with a microcontroller.
Sourav Gupta
PermalinkWhat is happeing when you sending a and b?
- Log in or register to post comments
Joined February 12, 2018 696Monday at 02:11 PM