Baud Rate - SKKCA-21

Bluetooth, XBee, RF......

Baud Rate - SKKCA-21

Postby Bowl » Wed May 25, 2011 1:36 am

The default baud rate of SKKCA-21 is 115200bps. I am using Hyperterminal to test.
Hardware: PIC16F877A, 20MHz Resonator.

Programming Language: PICBasicPro

The question is "What is the coding i should set if i want to set it to 9600bps"?

The coding below doesn't work if SPBRG is set to 129 (9600bps).
Nothing is displayed when i typed on the PC's keyboard after establishing communication.

What i tried and didn't work?

1. I set the port's bps in Device Manager as 9600bps and set port settings for Hyperterminal 9600bps.

2. Port's bps in Device Manager is set to 115200bps and port setting for Hyperterminal to 115200bps

Spoiler: show
'****************************************************************
'* Name : Echo And Send.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 4/14/2011 *
'* Version : 1.0 *
'* Notes : PIC 16F877A echoes characters received by the PC *
'* : *
'****************************************************************
DEFINE OSC 20 ' Oscillator speed is set to 20MHz
TRISB = %11111111
TRISC = %10000000 ' RC.7 => USART RX pin set to input
TRISD = %00001000
PortC = 0
SPBRG = 129 ' Baud Rate = 9600
i VAR BYTE
CLEAR

RCREG = 0

' Variable definition
' ===================
'

TXSTA.2 = 1 ' High speed
TXSTA.5 = 1 ' Enable transmit
RCSTA.7 = 1 ' Bit 7, SPEN, Enable USART
RCSTA.4 = 1 ' Bit 4, CREN, Enable Continuous Receive

mainloop:

IF (PIR1.5 = 1) AND (PIR1.4 = 1) THEN ' Register RCIF is full & TXIF is empty

i = RCREG

TXREG = i

ENDIF

GOTO mainloop

END


The coding works if SPBRG = 10 (115200bps), Port's bps in Device Manager is set to 115200bps and port setting for Hyperterminal to 115200bps.

Ideas?
Bowl
Freshie
 
Posts: 6
Joined: Sat Apr 09, 2011 8:27 pm

Re: Baud Rate - SKKCA-21

Postby ober » Wed May 25, 2011 9:49 am

A bit confuse here.

Let me understand the hardware interface first. Is your system being connected in such a way?

PIC's UART --- SKKCA-21's UART --- Bluetooth wireless link --- Bluetooth Dongle/Bluetooth on computer -- HyperTerminal

Right?

So now you have tested UART communication at 115200bps and it works, you change to 9600 and it does not work.

The question is, where did you change to 9600?
1. You change the UART of PIC to 9600.
2. You change the HyperTerminal setting to 9600.
3. But did you change the baud rate of SKKCA-21 to 9600?

The UART baud rate of SKKCA-21 is not controlled by the setting of HyperTerminal, nor the PIC's UART baud rate. Instead it is control by the KC-21 Bluetooth module on SKKCA-21. Your PIC uses 9600, SKKCA-21 still using 115200 bps, both of them cannot communicate, therefore there is nothing display even the Bluetooth link is established.

How to change the SKKCA-21 baud rate? I will recommend changing it using USB connection. Refer to the USer's Manual, connect the SKKCA-21 to computer through USB connection, Setup the HyperTerminal accordingly. Download the KC Serial User Guide v2.4 from product page of SKKCA-21. Refer to "AT+ZV ChangeDefaultBaud", you should be able to change the default baudrate.

Good luck!
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 10 guests

cron