Sunday, 30 September 2012

34

24 September - 30 September 2012
Assembly Programming using MPLAB development tools

(1) Setting Hardware (PIC) and configuration

Example:
;////////////////////////////////////////////////////////////////////////////////////////
;Set PIC = 16F877
;Set PIC configuration Setting
;////////////////////////////////////////////////////////////////////////////////////////


                                                list           p=pic16f877a                         ;MUST SET TO PIC MODEL IN USED
                                                include    p16f877a.inc
                                                __config  0x1E72                                    ;CONFIGURATION VALUE SETTING – refer to
                                                                                                                ;MPLAB menu, configure and configuration
                                                                                                                ;bits (value change on different setting)
                                                errorlevel               -302                          ;Suppress bank warning


(2) Variable Declaration

Example:
;////////////////////////////////////////////////////////////////////////////////////////
;Variable declaration -- any variable to be use must be declared here before it can be use in the main program
;////////////////////////////////////////////////////////////////////////////////////////
               

CBlock 0x20            ; Declaration started at this address
N                             ; Delay registers. Can be any name as long it’s not conflict with ; internal variable used in PIC ROM memory.
N1
                                                count1
                                                counta
                                                countb
                                                countc
                                                M0
                                               
                                                ENDC                      ;By using CBlock function, we must end it with ENDC


(3) Program Start – Initialization Process

Example:
;////////////////////////////////////////////////////////////////////////////////////////
;Set IO
;Initialize LCD
;Display start up message to LCD for intro
;Set default variable value
;////////////////////////////////////////////////////////////////////////////////////////
start                                        call initports                           ; call subroutine to initialize Input & Output setting
                                                                                                ;(refer sample 3a)
                                                call INITLCD                          ; call subroutine to initialize LCD (refer sample 3b)
                                                call clrscreen                          ; call subroutine to Clear LCD SCREEN
                                                call DisReady                          ; call subroutine  Display message to LCD during
                                                                                                ;hardware boot up.
                                                call visualdelay                       ;Delay routine use to hold display on LCD
                                                call SECOND_1                       ;2s delay before proceed to the next instruction
                                                call SECOND_1
                                                movlw d'20'                            ;Set Default value inside variable (depend on project
                                                                                                ;function)
                                                movwf TSPD1
                                                movlw d'100'
                                                movwf TSPD2
                                                bcf PORTD,2                           ;Turn Off Motor
                                                bcf PORTD,3
                                                bcf PORTC,4

Sunday, 16 September 2012

33

10 Spetember - 16 September 2012
software that will be use to write the coding using MPLAB. 
  • MPLAB software – can be download  from www.microchip.com
    •  Use to write microcontroller coding
  •  Programming language
    • Assembly 
      • Also known as low level language
      • The Instruction code comprise of a short form of words (e.g. move – mov)
    •  High Level Language 
      • Just like human language
      •  Easy to understand by non technical person
Why use assembly language for this project?

Assembly
Others (High Level Language)
Built in assembler in MPLAB software
Proof working compiler – need to buy (too expensive)
MPLAB can be download without any prices
Using freeware compiler – Limited function and need to confirm the functionality
Documentation to refer – Only Datasheet
Limited references and sample code to study
So many references – Note, Sample, Instruction code details, datasheet and etc
Need to study the compiler documentation.
Reduce development  time
Increase development time

Sunday, 9 September 2012

32

3 September - 9 September 2012
the hardware part have do some research on relay. from there i think i want to use assembly language. it is much more easier to burn the coding into the PIC. should have no problem and no more changes on the software part.

Sunday, 2 September 2012

31

27 August - 2 September 2012
hectic week. just come back from holidays. need to catch up on all the coding. the hardware part is not finalize yet. getting shivering here. my coding still cannot be test on the hardware..hope she will finalize it as soon as possible..

Sunday, 26 August 2012

30

20 August - 26 August 2012
have discuss with the hardware part. she has to use relay and i need to program which intercom will "on" when the "number" have been called. i give it a try on VB. NET. i get the picture to do it.

p/s:-will upload pictures later

Sunday, 19 August 2012

29

13 August - 19 August 2012
have good news today. the hardware part have given the schematic diagram. will look further on that. hope my software can integrate with the hardware.

p/s:- will upload the pictures later..internet so slow..

Sunday, 12 August 2012

28

6 August - 12 August 2012
Second week of July semester. Have started to build up coding for the hardware. but still in the "try and error" phase because the hardware part still got problem. Will upload the pictures later.