kinjal_ic
Newbie level 5
c30 asm
Hi,
My question is that how we can mix assembly language in c with MPLAB c30 C compiler. :?:
for example
for example I want to place a function in my C program for eeprom writing (not dependent on any .h file), say write(int address,int data) then is it possible to pass these variables to any assembly function such as that found in dspic30f4011 data sheet, which is as under:
-------------------
(Sorry for my bad english)
Hi,
My question is that how we can mix assembly language in c with MPLAB c30 C compiler. :?:
for example
Code C - [expand] 1 2 3 4 #asm{ xxxxxx; xxxxxx; }
for example I want to place a function in my C program for eeprom writing (not dependent on any .h file), say write(int address,int data) then is it possible to pass these variables to any assembly function such as that found in dspic30f4011 data sheet, which is as under:
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; Setup a pointer to data EEPROM MOV #tblpage(EE_ADDR),W0 MOV W0,TBLPAG MOV #tbloffset(EE_ADDR),W0 ; Write data value to holding latch MOV EE_DATA,W1 TBLWTL W1,[ W0] ; NVMADR captures write address from the TBLWTL instruction. ; Setup NVMCON for programming one word to data EEPROM MOV #0x4004,W0 MOV W0,NVMCON ; Disable interrupts while the KEY sequence is written PUSH SR MOV #0x00E0,W0 IOR SR ; Write the key sequence MOV #0x55,W0 MOV W0,NVMKEY MOV #0xAA,W0 MOV W0,NVMKEY ; Start the write cycle BSET NVMCON,#WR ;Re-enable interrupts, if needed POP SR
-------------------
(Sorry for my bad english)
Last edited by a moderator: