Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Looping code of no change

Status
Not open for further replies.
This could sound really funny to others because it's so newbie.

But, is there any problems I could run into with looping an area of code that doesn't change?

I coded this simple LED emission .ASM: **broken link removed**

This is my first code from the top of my head and I've only been learning 2 days, so there could be some grave errors in there.

But, the only error MPLAB picked up was "CORE-E0002" which apparently means I haven't put in a goto (Didn't realise it was compulsory), so I just put a "START" and "goto START" around the code that turns all the LEDs on.

MPLAB hasn't disagreed, but is this correct application?
 
It's kind of funny that way with MCU programming, not so much with general computing since programs are so much bigger and loops are often transparent with object oriented programming. I'm not an expert, but I've done a number of projects that required MCU programming. In some cases, I find myself only running through a code block when a certain condition occurs and other times I find myself running through code block unconditionally even setting bits or register values that have already been set. Intuitively, it doesn't seem right, but functionally, it doesn't matter one bit (so to speak, hehe).

In any case, I wouldn't get hung up on it. I don't think there's anything wrong with redundancy in your code if you can't do a task simply without it. Just let it run the way it runs.
 
It's kind of funny that way with MCU programming, not so much with general computing since programs are so much bigger and loops are often transparent with object oriented programming. I'm not an expert, but I've done a number of projects that required MCU programming. In some cases, I find myself only running through a code block when a certain condition occurs and other times I find myself running through code block unconditionally even setting bits or register values that have already been set. Intuitively, it doesn't seem right, but functionally, it doesn't matter one bit (so to speak, hehe).

In any case, I wouldn't get hung up on it. I don't think there's anything wrong with redundancy in your code if you can't do a task simply without it. Just let it run the way it runs.

Ahh, okay thanks. :) I guess I'll just plug her in and see what happens. :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top