Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 27, 2024, 12:35:37 00:35


Login with username, password and session length


Pages: [1]
Print
Author Topic: Embedding a whole asm in proton?  (Read 5180 times)
0 Members and 1 Guest are viewing this topic.
irvinos
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 29
-Receive: 28


« on: March 09, 2008, 11:35:02 23:35 »

Hi,
Is it possible embedding a whole asm programm in a proton+ pic basic programm?
tnx
Logged
Kabron
Active Member
***
Offline Offline

Posts: 198

Thank You
-Given: 64
-Receive: 144



« Reply #1 on: March 11, 2008, 01:18:21 13:18 »

Why not? I made it no one times.
Logged
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #2 on: March 11, 2008, 03:57:28 15:57 »

Why not? I made it no one times.


can u share ur idea?
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 763

Thank You
-Given: 173
-Receive: 1298



« Reply #3 on: March 11, 2008, 04:57:19 16:57 »

it is simple that insert your code like this :
Code:
ASM:
     .
     .
     Your assembly code
     .
     .
ENDASM

Or you can just insert the symbol @ before the assembly instruction without the ASM and ENDASM modifier:

Code:
Trisb = 0
@movlw 0x01
@movwf TRISA
Logged
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #4 on: March 11, 2008, 05:51:36 17:51 »

Thanks for ur reply.

but what do u think about include file or lib for proton, which contain asm. Huh
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 763

Thank You
-Given: 173
-Receive: 1298



« Reply #5 on: March 11, 2008, 08:49:23 20:49 »

if all the include is in assembly then it is simple, just use ASM befor the include instruction and add ENDASM after it. I have try it before
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #6 on: March 11, 2008, 10:08:40 22:08 »

Is it possible embedding a whole asm programm in a proton+ pic basic programm?

Hi 'irvinos',

Yes, it's possible, but you must declare the variables (before using) in the "Proton" style. For example:
 Dim v1 As Byte
 Dim v2 As Byte
 ...
 movlw 10     ; put dec 10 to w register (pic's accumulator register)
 movwf v1     ; v1 = w (v1 = 10)
 movwf v2     ; v2 = w (v2 = 10 too)
 subwf v2, w  ; w = v2 - w (w = 0)
 ...
And no, it doesn't needed the using of the ASM-ENDASM pair in Proton, the compiler knows also the asm instr's.

Hope this helps
zuisti
 
Logged
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #7 on: March 24, 2008, 09:27:23 21:27 »

i want to convert interrupt asm to pds, how  Huh

INTERRUPT
   bcf INTCON,GIE
   movwf W_SAVE
   movf STATUS,w
   movwf S_SAVE
   bcf PIR1,TMR1IF
   bcf T1CON,TMR1ON
   btfsc 0x2B,0     ; 2B,0  =  1 then
   goto masud   
   btfsc 0x2C,3
   goto RE_SET   
   goto EXIT

EXIT:
   movf S_SAVE,w
   movwf STATUS
   movf W_SAVE,w
   bsf INTCON,GIE
   retfie
   
Logged
twonuts
Active Member
***
Offline Offline

Posts: 117

Thank You
-Given: 55
-Receive: 42


« Reply #8 on: March 25, 2008, 10:58:15 10:58 »

i want to convert interrupt asm to pds, how  Huh

INTERRUPT
   bcf INTCON,GIE
   movwf W_SAVE
   movf STATUS,w
   movwf S_SAVE
   bcf PIR1,TMR1IF
   bcf T1CON,TMR1ON
   btfsc 0x2B,0     ; 2B,0  =  1 then
   goto masud   
   btfsc 0x2C,3
   goto RE_SET   
   goto EXIT

EXIT:
   movf S_SAVE,w
   movwf STATUS
   movf W_SAVE,w
   bsf INTCON,GIE
   retfie
   

READ PDS help for ON_INTERRUPT, and ON INTERRUPT. These are different commands for hardware and software interrupts.
Then write your interrupt routine in basic.

You have errors in your code above.

GOTO EXIT is not needed as the exit label is on the next line of your program.

GOTO RE_SET jumps out of your interrupt before completing the routine and without restoring system variables. Unless you are doing a complete hard reboot of the controller at the label RE_SET, your program will probably crash.
Logged
Kabron
Active Member
***
Offline Offline

Posts: 198

Thank You
-Given: 64
-Receive: 144



« Reply #9 on: March 25, 2008, 02:51:51 14:51 »

bcf INTCON,GIE and bsf INTCON,GIE are not nessesary as the PIC make it automatically.
bcf PIR1,TMR1IF - better to arrange just before retfie.
Logged
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #10 on: April 22, 2008, 02:37:29 14:37 »

bcf INTCON,GIE and bsf INTCON,GIE are not nessesary as the PIC make it automatically.
bcf PIR1,TMR1IF - better to arrange just before retfie.

thanks for ur reply, i have write asm for 16f72 , when i convert it proton its need more space for code, so 16f873 is better. so forget it to go for 16f873. but i have learn proton is powerfull. when proton goes to dspic then it will more powerfull, like proteus.

thanks

Posted on: March 25, 2008, 03:14:02 15:14 - Automerged

how can i convert it to basic

math conversion. and convert %

CONVERT
    CLRF TEMPA
    MOVLW .8    ;0x08
    MOVWF LOOP_COUNTER
SAMUN
    RLF LOW_VALUE,W
    RLF TEMPA,F
    MOVF SHIFT,W
    SUBWF TEMPA,F
    BTFSC STATUS,C ;IF BIT C =1 THEN
    GOTO RANA
    ADDWF TEMPA,F
    BCF STATUS,C
RANA
    RLF LOW_VALUE,F
    DECFSZ LOOP_COUNTER,F
    GOTO SAMUN
;======================================
   
    CLRF TEMPB
    MOVLW .8      ;0x08
    MOVWF LOOP_COUNTER
RUMAN
    RLF HIGH_VALUE,W
    RLF TEMPA,F
    RLF TEMPB,F
    MOVF SHIFT,W
    SUBWF TEMPA,F
    CLRF MOZIBOR
    CLRW
    BTFSS STATUS,C   ;IF C = 0 THEN      ;IF BIT C =0 THEN
    INCFSZ MOZIBOR,W
    SUBWF TEMPB,F
    BTFSC STATUS,C      ;IF BIT C =1 THEN
    GOTO CONVERT_LOOP
 
    MOVF SHIFT,W
    ADDWF TEMPA,F
    CLRF MOZIBOR
    CLRW
    BTFSC STATUS,C      ;IF BIT C =1 THEN
    INCFSZ MOZIBOR,W
    ADDWF TEMPB,F
    BCF STATUS,C
CONVERT_LOOP
    RLF HIGH_VALUE,F
    DECFSZ LOOP_COUNTER,F
    GOTO RUMAN
    MOVF TEMPA,W
    RETURN
;==========================================================

MITHUN
    CLRF TEMPC
    MOVF LOW_VALUE,W
    MOVWF TEMPD
    MOVF HIGH_VALUE,W
    MOVWF LCD_LOOP1
    MOVLW 0x08
    MOVWF LOOP_COUNTER
HANNAN
    RRF SHIFT,F
    BTFSC STATUS,C   ;IF BIT C =1 THEN
    GOTO SAKIB
    DECFSZ LOOP_COUNTER,F
    GOTO HANNAN
    CLRF LOW_VALUE
    CLRF HIGH_VALUE
    RETLW 0x00
;==========================================================
SAKIB
    BCF STATUS,C
    GOTO TUSHAR
BARKAT
    RRF SHIFT,F
    BTFSS STATUS,C   ;IF BIT C =0 THEN
    GOTO TUSHAR
    MOVF LCD_LOOP1,W
    ADDWF HIGH_VALUE,F
    MOVF TEMPD,W
    BTFSC STATUS,C   ;IF BIT C =1 THEN
    INCFSZ TEMPD,W
    ADDWF LOW_VALUE,F
TUSHAR
    RRF LOW_VALUE,F
    RRF HIGH_VALUE,F
    RRF TEMPC,F
    DECFSZ LOOP_COUNTER,F
    GOTO BARKAT
    RETLW 0x00
;=======================================================

INIT_VALUE
    MOVF MAIN_VALUE,W
    ADDWF MAINS_H,F
    BTFSC STATUS,C ;IF BIT[STATUS:C]= 1 THEN
    INCF MAINS_L,F
    MOVF CHARG_LOAD_VER,W
    ADDWF CHARGE_LOAD_H,F
    BTFSC STATUS,C   ;IF BIT[STATUS:C]= 1 THEN
    INCF CH_LOD_L,F
    INCF RAM_1,F   ;0x7C,F
    MOVLW 0xF0    ;.240
    SUBWF RAM_1,W    ; RAM_1 - W = ?
    BTFSS STATUS,C   ;IF BIT C =0 THEN
    RETURN
    MOVF MAINS_H,W
    MOVWF MAINS_H_VALUE
    MOVF MAINS_L,W
    MOVWF MAINS_L_VALUE
    MOVF CHARGE_LOAD_H,W
    MOVWF CHARGE_LOAD_VALUE_H
    MOVF CH_LOD_L,W
    MOVWF CHARGE_LOAD_VALUE
    CLRF RAM_1   ;0x7C
    CLRF MAINS_H
    CLRF MAINS_L
    CLRF CHARGE_LOAD_H
    CLRF CH_LOD_L
    RETURN

;==========================================================
CONVERT_CHAR_LOAD_PER
    MOVLW .240     ;0xF0    ;
    MOVWF SHIFT
    MOVF CHARGE_LOAD_VALUE_H,W
    MOVWF HIGH_VALUE
    MOVF CHARGE_LOAD_VALUE,W
    MOVWF LOW_VALUE
    CALL CONVERT
    MOVLW .100    ;0x64
    MOVWF SHIFT
    CALL MITHUN
    MOVLW .150  ;0x96
    BTFSC INV_ON  ;IF UPS = 1 THEN
    MOVLW .22   ;0x16
    MOVWF SHIFT
    MOVF HIGH_VALUE,W
    MOVWF LOW_VALUE
    MOVF TEMPC,W
    MOVWF HIGH_VALUE
    GOTO CONVERT
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC