PR6A project Question

Bluetooth, XBee, RF......

PR6A project Question

Postby cheekangteh » Mon Apr 09, 2012 8:10 pm

CODE: SELECT_ALL_CODE
//=============================================================================================
//
//   Author            :Cytron Technologies      
//   Project            :DIY Project
//   Project description   :PR6-Bluetooth Remote Control
//  Date            :21 May 2009
//
//=============================================================================================


//=============================================================================================
// Include file
//=============================================================================================
#include <pic.h>


//=============================================================================================
// Configuration
//=============================================================================================
__CONFIG(0x3F32);


//=============================================================================================
//Define
//=============================================================================================
//#define seg PORTD            // define 7 segment as PORTD


//==============================================================================================
// Function Prototype
// User can write all the necessary function here
//==============================================================================================
   
unsigned char a;

void init(void)               // subroutine to initialize           
{   
   SPBRG=0x0A;               // set baud rate as 115200 baud
   BRGH=0;   
   TXEN=1;
   CREN=1;
   SPEN=1;
//   TRISD = 0b00000000;         
//   seg   = 0b00000000;         
}

void display(unsigned char c)      // subrountine to display the text on the screen   
{
   while (TXIF == 0);
   TXREG = c;   
}

unsigned char receive(void)         // subrountine to receive text from PC
{
   while (RCIF == 0);
   a = RCREG;
   return a;
}


//================================================================================================
//   Main Function
//   This is the main function where program start to execute
//================================================================================================
void main(void)
{
   init();

   while(1)            // Wait for 'ok' to be entered by user
   {
      a = receive();                        
      if (a == 'o')                   
         {
            a = receive();
            if (a == 'k') break;
         }
   }


      display('C');         // Text will display on Hyperterminal after 'ok' is entered
      display('y');
      display('t');
      display('r');
      display('o');
      display('n');
      display(0x0a);         //Go to new line   
      display(0x0d);         
      display('P');
      display('r');
      display('e');
      display('s');
      display('s');
      display(0x20);         // Space
      display('a');
      display('n');
      display('y');
      display(0x20);         // Space
      display('n');
      display('u');
      display('m');      
      display('b');
      display('e');
      display('r');

//      seg = 1;   

      // wait for number and display it on 7 segment
        // The number display on 7 segment is depends on what number entered in Hyperterminal.
   /*   while(1)   
      {
         a = receive();
         if (a=='1'||a=='2'||a=='3'||a=='4'||a=='5'||a=='6'||a=='7'||a=='8'||a=='9'||a=='0')
         {
         //   seg = a-0x30;
         }
      }*/
}




hi above i attached the code that after edited by me. i wish to checking the configuration between PIC16F877A and Bluetooth module with my Laptop Bluetooth dongle by using above code. (my action is in correct way?)

supposedly when i key "ok" in hyperterminal, it will automatically display "Cytron Press any number",
but when i key in "ok" by using hyperterminal laptop, it show me nothing.

kindly advice . please provide me a direction to continue it. Your comment will be very appreciated. tq
cheekangteh
Apprentice
 
Posts: 36
Joined: Mon Dec 26, 2011 5:20 pm

Re: PR6A project Question

Postby cheekangteh » Tue Apr 10, 2012 7:59 pm

hi, i know what the problem now, after i used 20Mhz crystal, the problem solve.
But
When i key "ok" in hyperterminal, it can't show me "cytron press any number" in hyperteminal, but i checked the bluetooth serial port status in BlueSoleil it show my i send 2 bytes and revived 24 bytes.

Kindly advice why i can't get "cytron press any number" in hyperteminal. tq
cheekangteh
Apprentice
 
Posts: 36
Joined: Mon Dec 26, 2011 5:20 pm

Re: PR6A project Question

Postby cheekangteh » Thu Apr 12, 2012 5:57 pm

cheekangteh WROTE:hi, i know what the problem now, after i used 20Mhz crystal, the problem solve.
But
When i key "ok" in hyperterminal, it can't show me "cytron press any number" in hyperteminal, but i checked the bluetooth serial port status in BlueSoleil it show my i send 2 bytes and revived 24 bytes.

Kindly advice why i can't get "cytron press any number" in hyperteminal. tq


i try sk40c device with bluetooth module SKCCA-21. the problem still there, When i key "ok" in hyperterminal, it can't show me "cytron press any number" in hyperteminal, but i checked the bluetooth serial port status in BlueSoleil it show my i send 2 bytes and revived 24 bytes.

kindly advice, what should i continue? isn't the module break down? thanks
cheekangteh
Apprentice
 
Posts: 36
Joined: Mon Dec 26, 2011 5:20 pm

Re: PR6A project Question

Postby robosang » Thu Apr 12, 2012 10:30 pm

Have you verify the connection using computer?

computer A --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer B.

Do this first 8-)
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PR6A project Question

Postby cheekangteh » Sat Apr 14, 2012 9:20 pm

hi i tried b4. i try with two set.. but it give me two set of result.

first set:
computer A --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer B.
both computer can communicate nicely, what both type and send display nicely in both computer hyperteminal.

second set:
computer A --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer C.

computer A only can display what had been send, and computer c can display those sending and received.

what bring this happened? kindly advice. thanks
cheekangteh
Apprentice
 
Posts: 36
Joined: Mon Dec 26, 2011 5:20 pm

Re: PR6A project Question

Postby robosang » Mon Apr 16, 2012 9:55 pm

Wah.... this one really no idea what happen, might be the setting? I also out of idea. 8-)
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PR6A project Question

Postby cheekangteh » Tue Apr 17, 2012 4:10 pm

hi sir,
may i know what you mean by setting? setting for skkca-21 or hyperteminal?

for the
second set:
computer A --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer C.

i got try to exchange the orientations, means
1. computer A --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer C.
2. computer C --- USB Bluetooth Dongle ----- Bluetooth link -------- SKKCA-21 --- USB ---- Computer A.

for the hyperterminal (computer) that attached to SKKCA-21 it can show the receive and transmit data.
but for the hyperteminal (computer) that jz attached the bluetooth dongle it jz can showing the transmit data.

i am quite surprise with this.. any idea?
cheekangteh
Apprentice
 
Posts: 36
Joined: Mon Dec 26, 2011 5:20 pm


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 12 guests