I have a sim900 device that can accept 200 or so AT commands. I am currently setting boolean flags based on certain responses with if and then statements. However, this is not scaling very well. I was wondering if there was example code or a tutorial out there that showed a correct approach for parsing AT commands. It doesn't have to be for the sim900 device but anything in general.
I'm trying to parse AT commands to my cell too! I have a RBBB and I hooked up the D- cable to the Tx pin of the board, but haven't figured out to send commands.
I did find this code written in assembly by someone who seems to have done it, but I'm not sure entirely what's going on.
;****define registers*****
STATUS equ 03h
TXREG equ 19h
TXSTA equ 98h
SPBRG equ 99h
RCSTA equ 18h
TRISC equ 87h
CounterL equ 20h
CounterH equ 21h
;******init******
bsf STATUS,5;to bank 1
movlw b'00000001'
movwf TRISC
movlw b'00100110'
movwf TXSTA
movlw b'00011001'
movwf SPBRG
bcf STATUS,5
movlw b'10010000'
movwf RCSTA
;*****start Tx*****
main
movlw "A"
movwf TXREG
call delay
call delay
call delay
movlw "T"
movwf TXREG
call delay
call delay
call delay
; Here put the characters in the AT command you want to give to the phone as givenĀ above one by one. First the character "A"...then "T"...then characters of your commands. The RXREG do the conversion of the character into the ASCII code. You don't have to worry about it.
delay
decfsz CounterL,1
goto delay
decfsz CounterH,1
goto delay
return
end
If you can get it to work, tell me, ok?