Wednesday, 24 October 2012

FYP 2 (WEEK 9)

WEEK 9


Title of Activity

  • Program for PIC and GSM (PART II)


Objective

  • To gain more knowledge from the programming
  • To create a program that suits the project


Content / Procedure

;----------------------------------Program for GSM-----------------------------------------------------------;


SendSMScommand
bcf RCSTA,CREN ;pulse cren off...
movf RCREG,W ;flush fifo
movf RCREG,W ; all three elements.
movf RCREG,W

movlw A'A'
call transmit
movlw A'T'
call transmit
movlw A'+'
call transmit
movlw A'C'
call transmit
movlw A'M'
call transmit
movlw A'G'
call transmit
movlw A'S'
call transmit
movlw A'='
call transmit
movlw A'"'
call transmit
movlw A'0'
call transmit
movlw A'1'
call transmit
movlw A'3'
call transmit
movlw A'7'
call transmit
movlw A'0'
call transmit
movlw A'3'
call transmit
movlw A'7'
call transmit
movlw A'8'
call transmit
movlw A'4'
call transmit
movlw A'8'
call transmit
movlw A'"'
call transmit
movlw d'13'
call transmit
movlw d'10'
call transmit
call SECOND_1
return


MSG_ALM movlw A'P'      ;TEXT data being send
call transmit
movlw A'e'
call transmit
movlw A'm'
call transmit
movlw A'a'
call transmit
movlw A'n'
call transmit
movlw A'd'
call transmit
movlw A'u'
call transmit
movlw A' '
call transmit
movlw A'P'
call transmit
movlw A'e'
call transmit
movlw A'n'
call transmit
movlw A'g'
call transmit
movlw A's'
call transmit
movlw A'a'
call transmit
movlw A'n'
call transmit
movlw A'!'
call transmit
movlw A'!'
call transmit
movlw d'26' ;value for <ctrl Z>
call transmit
bcf RCSTA,CREN ;pulse cren off...
movf RCREG,W ;flush fifo
movf RCREG,W ; all three elements.
movf RCREG,W
bsf RCSTA,CREN ;turn cren back on.
          return


Delete1 call SECOND_1
call SECOND_1
call SECOND_1
   bcf RCSTA,CREN ;pulse cren off...
movf RCREG,W ;flush fifo
movf RCREG,W ; all three elements.
movf RCREG,W
movlw A'A' ;;set to text mode
call transmit
movlw A'T'
call transmit
movlw A'+'
call transmit
movlw A'C'
call transmit
movlw A'M'
call transmit
movlw A'G'
call transmit
movlw A'D'
call transmit
movlw A'='
call transmit
movlw A'1'
call transmit
movlw d'13'
call transmit
movlw d'10'
call transmit
call SECOND_1
call SECOND_1
return

;--------------------------------------- END of Program------------------------------------------------;


Analysis

The output from the program is " PEMANDU PENGSAN " . This message are sent to the user to mentioned that the driver are collapse or fainted during the driving. The message to the ambulance or police will be send if the driver did not push the reset button in a certain time that have been set.


Conclusion

During the programming part, what can be conclude is to generate a program is not easy. We must understand each single command in order to give the right command to the controller.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.