AT commands

matt2466

Member
Hi!

I would like my 08M to send an AT command to my bluetooth module but i'm not very sure in what format do I send the command in. At the moment I have this line of code:

serout 0, T2400, (AT+BTLPM,n0x0D)

where n = 0 or 1 and 0x0D is suppose to be the ascii code for carriage return. Should I send the above as a string by including " " quotes?

Thanks for any help.
 

BeanieBots

Moderator
I don't know about AT commands, but if you want to send ASCII, you must enclose it quotes and HEX values must be preceded with a $.
Does the "1" you need to be sent be ASCII "1" or numeric 1.

eg
b0=1 'or b0=0
b0 = b0 + $30 'if you need to convert to ASCII

serout 0, T2400, ("AT+BTLPM",b0,$0D)
 

matt2466

Member
Hey guys thanks for the reply.

I believe that AT commands sent via HyperTerminal are in ascii form therefore the need to use the ascii equivalent of CR (0x0D) so if thats the case maybe

serout 0, T2400, ("AT+BTLPM,1",0x0D) might work? Since 0x0D is already ascii I thought I might exclude the qoutes

Thoughts pls...
 

BeanieBots

Moderator
Yes, but you need to use the correct convention.
Either $0D or 13 or the pre-defined symbol CR.

serout 0, T2400, ("AT+BTLPM,1",CR) or
serout 0, T2400, ("AT+BTLPM,1",$0D) or
serout 0, T2400, ("AT+BTLPM,1",13)
 
Top