PR13-wireless smoke detector...

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

PR13-wireless smoke detector...

Postby kesigan07 » Mon Apr 23, 2012 12:09 am

HELP...how to change c language to assembly language... i need its assembler coding...
kesigan07
Freshie
 
Posts: 6
Joined: Sun Apr 22, 2012 11:03 pm

Re: PR13-wireless smoke detector...

Postby ABSF » Mon Apr 23, 2012 7:43 am

The Hi Tech C compiler doesnt produce intermediate asm file before it converts to the final hex file. AFAIK the Pic Basic Pro compiler does convert to ASM before the final object hex code.

Judging from the simplicity of the PR13 C program, I think it should be possible to convert it to an asm program manually. But you have to learn the PIC assembly instructions first and learn how to write asm program using mplab.

PR13 - Alarm System:Wireless Smoke Detector
http://www.cytron.com.my/viewProduct.ph ... nU=&store=

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13-wireless smoke detector...

Postby ABSF » Mon Apr 23, 2012 11:00 am

I just found a hex to asm program that was able to convert hex file to asm file and it's quite impressive. You can download it and try it out here...

http://talkingelectronics.com/projects/ ... mbler.html

You may use the output as your reference to write your final assembly program with proper comments. 8-)

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13-wireless smoke detector...

Postby kesigan07 » Mon Apr 23, 2012 10:23 pm

hye...i successfully changed the hex to asm by using disassemblers but i got an error in the coding i get from it for pic 16F876A...HELP

Error[126] D:\DOWNLOADS IDM\MICRO\SOURCE CODE PR13.ASM 295 : Argument out of range (07D6 not between 0000 and 03FF)..the coding are as below:-

CODE: SELECT_ALL_CODE
; original File = D:\downloads IDM\Compressed\micro\Source Code PR13\PR13.hex

    processor 16F876A
    #include <P16F876A.INC>
    __config 0x3F32
;   _CP_OFF & _DEBUG_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON
;   & _WDT_OFF & _HS_OSC

; RAM-Variable
LRAM_0x20 equ 0x20
LRAM_0x21 equ 0x21
LRAM_0x22 equ 0x22
LRAM_0x23 equ 0x23
LRAM_0x24 equ 0x24

; Program

    Org 0x0000

;   Reset-Vector
LADR_0x0000
    MOVLW 0x20
    MOVWF FSR
    MOVLW 0x25
    CALL LADR_0x000A
;   Interrupt-Vector
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    GOTO LADR_0x0745
LADR_0x0007
    XORWF FSR,W
    CLRF INDF
    INCF FSR,F
LADR_0x000A
    XORWF FSR,W
    BTFSS STATUS,Z
    GOTO LADR_0x0007
    CLRWDT
    RETLW 0x00

    Org 0x0719

LADR_0x0719
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    MOVF LRAM_0x24,W
    IORWF LRAM_0x23,W
    IORWF LRAM_0x22,W
    IORWF LRAM_0x21,W
    BTFSS STATUS,Z
    GOTO LADR_0x0722
    GOTO LADR_0x0723
LADR_0x0722
    GOTO LADR_0x0724
LADR_0x0723
    GOTO LADR_0x0742
LADR_0x0724
    MOVLW 0xFF
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    ADDWF LRAM_0x21,F
    MOVLW 0xFF
    BCF STATUS,Z
    BTFSC STATUS,C
    ADDLW 0x01
    BTFSS STATUS,Z
    ADDWF LRAM_0x22,F
    MOVLW 0xFF
    BCF STATUS,Z
    BTFSC STATUS,C
    ADDLW 0x01
    BTFSS STATUS,Z
    ADDWF LRAM_0x23,F
    MOVLW 0xFF
    BCF STATUS,Z
    BTFSC STATUS,C
    ADDLW 0x01
    BTFSS STATUS,Z
    ADDWF LRAM_0x24,F
    MOVF LRAM_0x24,W
    IORWF LRAM_0x23,W
    IORWF LRAM_0x22,W
    IORWF LRAM_0x21,W
    BTFSS STATUS,Z
    GOTO LADR_0x0741
    GOTO LADR_0x0742
LADR_0x0741
    GOTO LADR_0x0724
LADR_0x0742
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    RETURN
LADR_0x0745
    MOVLW 0xFF
    BSF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    MOVWF PORTB          ; !!Bank!! PORTB - TRISB - PORTB - TRISB
    CLRF PORTC           ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0xFF
    MOVWF PORTA          ; !!Bank!! PORTA - TRISA - Unimplemented - Unimplemented
    MOVLW 0x06
    MOVWF ADCON0         ; !!Bank!! ADCON0 - ADCON1 - Unimplemented - Unimplemented
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF PORTC,0          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    CLRF LRAM_0x20
    BCF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
LADR_0x0754
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BTFSC PORTB,0        ; !!Bank!! PORTB - TRISB - PORTB - TRISB
    GOTO LADR_0x0759
    GOTO LADR_0x075A
LADR_0x0759
    GOTO LADR_0x0760
LADR_0x075A
    CLRF LRAM_0x20
    INCF LRAM_0x20,F
    BSF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    GOTO LADR_0x0777
LADR_0x0760
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BTFSC PORTB,1        ; !!Bank!! PORTB - TRISB - PORTB - TRISB
    GOTO LADR_0x0765
    GOTO LADR_0x0766
LADR_0x0765
    GOTO LADR_0x076C
LADR_0x0766
    MOVLW 0x02
    MOVWF LRAM_0x20
    BCF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    GOTO LADR_0x0777
LADR_0x076C
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BTFSC PORTB,2        ; !!Bank!! PORTB - TRISB - PORTB - TRISB
    GOTO LADR_0x0771
    GOTO LADR_0x0772
LADR_0x0771
    GOTO LADR_0x0777
LADR_0x0772
    MOVLW 0x03
    MOVWF LRAM_0x20
    BCF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
LADR_0x0777
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BTFSS PORTA,0        ; !!Bank!! PORTA - TRISA - Unimplemented - Unimplemented
    GOTO LADR_0x077C
    GOTO LADR_0x077D
LADR_0x077C
    GOTO LADR_0x07FB
LADR_0x077D
    DECF LRAM_0x20,W
    BTFSS STATUS,Z
    GOTO LADR_0x0781
    GOTO LADR_0x0782
LADR_0x0781
    GOTO LADR_0x07A6
LADR_0x0782
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BSF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    BCF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    GOTO LADR_0x0782
    GOTO LADR_0x07FB
LADR_0x07A6
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    MOVF LRAM_0x20,W
    XORLW 0x02
    BTFSS STATUS,Z
    GOTO LADR_0x07AD
    GOTO LADR_0x07AE
LADR_0x07AD
    GOTO LADR_0x07CE
LADR_0x07AE
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BSF PORTC,0          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    BCF PORTC,0          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    GOTO LADR_0x07AE
    GOTO LADR_0x07FB
LADR_0x07CE
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    MOVF LRAM_0x20,W
    XORLW 0x03
    BTFSS STATUS,Z
    GOTO LADR_0x07D5
    GOTO LADR_0x07D6
LADR_0x07D5
    GOTO LADR_0x07FB
LADR_0x07D6
    BCF STATUS,RP0       ; !!Bank Register-Bank(0/1)-Select
    BCF STATUS,RP1       ; !!Bank Register-Bank(2/3)-Select
    BSF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BSF PORTC,0          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    BCF PORTC,1          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,2          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,3          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    BCF PORTC,0          ; !!Bank!! PORTC - TRISC - Unimplemented - Unimplemented
    MOVLW 0x50
    MOVWF LRAM_0x21
    MOVLW 0xC3
    MOVWF LRAM_0x22
    MOVLW 0x00
    MOVWF LRAM_0x23
    MOVLW 0x00
    MOVWF LRAM_0x24
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    CALL LADR_0x0719
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    GOTO LADR_0x07D6
LADR_0x07FB
    GOTO LADR_0x0754
    CLRF STATUS
    BCF PCLATH,4         ; !!Bank Program-Page-Select
    BCF PCLATH,3         ; !!Bank Program-Page-Select
    GOTO LADR_0x0000

    End


kesigan07
Freshie
 
Posts: 6
Joined: Sun Apr 22, 2012 11:03 pm

Re: PR13-wireless smoke detector...

Postby ABSF » Wed Apr 25, 2012 5:30 am

kesigan07 WROTE:Error[126] D:\DOWNLOADS IDM\MICRO\SOURCE CODE PR13.ASM 295 : Argument out of range (07D6 not between 0000 and 03FF)..the coding are as below:-


"295" is the line number in your asm code which points to GOTO LADR_0x07D6. The 16F876a has 8K of program space which is 0000 to 1FFF so you shouldnt get that error.

Did you select the device correctly during assembling?
What assembler program are you using? MPASM?
During disassembling, did you select "absolute code" or "relocatable code"?

I did the same thing you did and I got a successful assembling using MPLAB's MPASM.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13-wireless smoke detector...

Postby kesigan07 » Wed Apr 25, 2012 9:57 am

okay i got it...i forgot to change the setting...thanks...
can i get the schematic design(.DSN) file for the PR13...
kesigan07
Freshie
 
Posts: 6
Joined: Sun Apr 22, 2012 11:03 pm

Re: PR13-wireless smoke detector...

Postby sich » Wed Apr 25, 2012 4:54 pm

You can download from the Useful Document section of PR13 Product Page.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: PR13-wireless smoke detector...

Postby kesigan07 » Wed Apr 25, 2012 9:28 pm

inside product page there is no .DSN file. i need proteus design for pr13...HELP
kesigan07
Freshie
 
Posts: 6
Joined: Sun Apr 22, 2012 11:03 pm

Re: PR13-wireless smoke detector...

Postby kesigan07 » Sat May 05, 2012 6:45 pm

HELP...i need PCB design of PR13(.pcb)...
kesigan07
Freshie
 
Posts: 6
Joined: Sun Apr 22, 2012 11:03 pm

Re: PR13-wireless smoke detector...

Postby sich » Wed May 09, 2012 2:01 am

Everything you need to further develop your project based on PR13 is already there in the Useful Document section. You are free to copy the schematic and draw your own PCB using any software you like. Same goes to Proteus design...
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 11 guests

cron