0
Start   MOVLW 0xff          ; 0xff=b'11111111
        MOVWF PORTA         ;  on 

        MOVLW 0x00          ;
        MOVWF PORTA         ;  off 

        GOTO Start  

So I was following a video for how to make an LED blinging program with assembly for PIC16 F877A, but then i realized im using xc8 compiler and the compiler being used in the video is MPASM ( I think this is the problem from my understanding im pretty new to this stuff). Also could the problem be something else? I'd appreciate any help even if little bit.

6
  • You need a delay loop for a blinking LED Commented Mar 20, 2021 at 21:54
  • 2
    Yeah there are quite a lot of differences between the XC8 assembler and the MPASM assembler. Keep this document for your reference - you'll need it! There isn't very much info available on XC8 assembly. ww1.microchip.com/downloads/en/DeviceDoc/… Commented Mar 21, 2021 at 15:05
  • In XC8, labels must be followed by a colon (see section 3.2, page 9). Try Start: MOVLW 0xff. Commented Mar 21, 2021 at 15:07
  • You also need to clear TRISA to configure the pins as outputs. Commented Mar 22, 2021 at 4:22
  • Agree with @Mike. You will need a delay loop both after turning the LED on, and again after turning it off. With your existing code, the LED will be flashing, but so fast that your eye will not be able to discern it - you'll only see it on an oscilloscope. Commented Mar 22, 2021 at 14:58

2 Answers 2

1

The Syntax seems to be correct as long as you want to blink the led forever, but before this section you need to configure porta as output port and also you have to configure all porta pins as digital input output pins, secondly you need to specify some amount of delay, so as to notice the blinking effect because the microcontroller works on the instruction frequency of microseconds there should be some delay after on state as well as off state, I think you got my point. Here compiler in not supposed to have any conflicts but you can download mplab IDE, prior version of MPLAB x IDE, also it has lighter operation, which has mpasm compiler toolchain, Thankyou.

Sign up to request clarification or add additional context in comments.

Comments

0

Actions by Microchip and to some extent Apple have made most of the tutorials for the MPLABX IDE, and more specifically PIC controller assembly language, all but useless.

By installing the same versions of the Microchip tools as seen in your tutorial on the same kind of workstation it all "should" work for you as shown in the video.

If you could update your question to include a link to the video you are using, a less generic answer could be offered.

6 Comments

And this answers the question? Hmmm
@Mike, The posted comments address the syntax issues. I have tried to answer what appears to be the problem of the tutorial video being different from the tools the original poster has installed.
Normally it would make sense to show the correct syntax for the instructions the OP is trying to use, if it's possible to figure out what their code was supposed to do / be. Telling people to downgrade to old versions of tools is one option, but probably not the best long-term recommendation. If there's some general thing that changed, then explaining that would be a good idea. Or if many instruction or mnemonics changed in subtle different ways, maybe explain how to find the new way to write something.
@PeterCordes, From the continents and context of the question I could not determine what the Original Poster(OP) could best profit from. Having a working example to follow helps me learn so my recommendation is to setup the same tools as the tutorial. I could post two PIC16F877A applications for an LED blinking using both the MPASM and pic-as tool chains. The OP would be better of locating updated tutorials that show how to use the current MPLABX tools. But even the Microchip web site is years out of date in this regard.
What changed in the IDE / toolchain? If it's just the assembler syntax, someone that knows the old and new syntaxes should be able to port the OP's code line by line, right? That would seem like a useful part of a Q&A about this change, although agreed that people should find tutorials for the tools they're using instead of asking other people to port old tutorials. Still, some kind of example of how to translate seems like a good idea, unless there's some reason why that's not in general possible.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.