Project MPLAB IDE using Assembly language

Thread Starter

anukalp

Joined Jul 28, 2018
153
Hi

I want to create assembly project tp program PIC using MPLAB V 8.92

Project-> Project Wizard -> Next
Step 1 Device : PIC18F4550 -> Next
Step 2 select tool suite

1629351267870.png

Step 3 Create New project file : C:\Users\System\Desktop\Assembly Project\Test.mcp -> Next

1629352112932.png

Step Four -> Next

1629352357543.png

File -> new
save as : Test

Project -> add files to project
1629352715856.png
 

Attachments

trebla

Joined Jun 29, 2019
459
File > New. Then type some code in the editor window and then File > Save As in your project folder. Then in the project explorer window make right click on Source Files folder and then you can add recently saved file to your project. EDIT: make sure the file extension match the language type (.asm for assembler).;)
 

Thread Starter

anukalp

Joined Jul 28, 2018
153
File > New. Then type some code in the editor window and then File > Save As in your project folder. Then in the project explorer window make right click on Source Files folder and then you can add recently saved file to your project. EDIT: make sure the file extension match the language type (.asm for assembler).;)
I think I've done it.

I'm trying to understand assembly code given in here http://www.fypsolutions.com/assembl...-led-blink-code-example-in-assembly-language/

I am having trouble understanding code it's written without comments

Code:
LIST p=16F887             ;tell assembler what chip we are using
#include
<P16F887.INC>

__CONFIG  _CONFIG1, _INTOSCIO & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF & _LVP_OFF & _DEBUG_ON


CBLOCK h'20'
    COUNT1
    COUNT2
ENDC
    ORG        0x00

MAIN:
    BANKSEL        TRISB
    BCF         TRISB,0    
    BANKSEL        PORTB
MainLoop:
    BCF            PORTB,0
    CALL        DELAY3
    BSF            PORTB,0
    CALL        DELAY3
    GOTO        MainLoop            ; Do it again...
   

DELAY3:
    DECFSZ        COUNT1,1
    GOTO        DELAY3
    DECFSZ        COUNT2,1
    GOTO        DELAY3
    RETURN

END
Please help me to understand code
 

ericgibbs

Joined Jan 29, 2010
13,825
hi anukalp.
Do you have the datasheet for the 16F887 PIC.??

Which parts of the Code listing do you understand and not understand.?

E
 

trebla

Joined Jun 29, 2019
459
To make a port pin to output, write to TRIS register corresponding bit '0', for input write '1'.
For making digital inputs you must set ADCON0 register accordingly, see section "ANALOG-TO-DIGITAL CONVERTER (ADC) MODULE" in datasheet.
 

trebla

Joined Jun 29, 2019
459
Information about what PIN can be set to analog is in section "Pin Diagrams – PIC16F884/887" in the drawing but better seen in the table after drawing
 

MaxHeadRoom

Joined Jul 18, 2013
23,779
if you need further info, look up the free tutorials by Nigel Goodwin and some really good ones by Gooligum.
Both step you through all the commands in Assembly.
 

Thread Starter

anukalp

Joined Jul 28, 2018
153
if you need further info, look up the free tutorials by Nigel Goodwin and some really good ones by Gooligum.
Both step you through all the commands in Assembly.
Can you provide link for Gooligum tutorial which is free. I've searched but can't find
 
Top