I am trying to convert one of my old codes to work on Arduino. My question is how can I convert this code into Arduino. Some guidelines to getting somewhere close to this example please.
xorlw ARef
xorlw KRef
btfsc STATUS,Z
goto WriteToSD
I am trying to convert one of my old codes to work on Arduino. My question is how can I convert this code into Arduino. Some guidelines to getting somewhere close to this example please.
xorlw ARef
xorlw KRef
btfsc STATUS,Z
goto WriteToSD
Is your first name Bill?
...or Pearly?
Seriously, assembler for XOR (long word), bit test (status register) and goto, but by itself the snippet is meaningless
Nick Gammon:
Is your first name Bill?
No need to be a smartass to me.
AWOL:
Seriously, assembler for XOR (long word), bit test (status register) and goto, but by itself the snippet is meaningless
I cant seem to test ARef ^ KRef to set off an internal flag. I must admit, I don't know if the software allows this to be done. Can you suggest a walk around that will perform the same task.
but by itself the snippet is meaningless
The code is in assembler so I didn't attach the code.
It isn't even AVR assembler, so I won't attach my reply.
Gates:
I am trying to convert one of my old codes to work on Arduino. My question is how can I convert this code into Arduino. Some guidelines to getting somewhere close to this example please.xorlw ARef
xorlw KRef
btfsc STATUS,Z
goto WriteToSD
My thought is that you wouldn't convert it in the simple sense of this line => that line...
I think you would have to de-code the assembler into (eg) a flowchart or psuedo-code, then use that to write code for the Arduino. In fact if you know exactly what the code is supposed to do, it might even be easier to disregard the assembler and start from from scratch.
I'm pretty sure it is PIC, but the condition could be part of a "while" or an "if", but
I cant seem to test ARef ^ KRef to set off an internal flag.
is thinking in low-level language in an intermediate language (C) world.
You don't test status flags, you get the compiler to do it for you.
Gates:
No need to be a smartass to me.
Your original question is completely meaningless.
Watch your manners or you will be banned. This is simple trolling.
xorlw ARef
xorlw KRef
btfsc STATUS,Z
goto WriteToSD
What is Aref? What is KRef? What is STATUS? Where is WriteToSD?
Read this before posting a programming question
Code tags.
Thank you,
I was thinking of that today. I am thinking of: (if>condition) (else <=) and repeat until if else are equal to (while=value) store values to SD card and read the last values compared to values current.
FYI: My first name is David
OK, so "btfsc" is PIC-speak for "Bit Test Flag, Skip if Clear"
So, if the Z bit of the status register is zero, skip to the instruction after the "goto".
The Z bit will therefore have been set or reset depending on result of the preceding XOR operations.
I wasn't trolling as you call it. I posted code that wasn't directly Arduino. I was asking for help to convert the code to use the software correctly. (I never posted the complete code) to be trolling. Ban me if you wish.
I posted code that wasn't
directlyremotely Arduino
thanks for the correction AWOL
AWOL:
It isn't even AVR assembler, so I won't attach my reply.
I don't understand, he has a programming question as far as I can see. He wants to know how to convert that PIC assembler code in the equivalent on the Arduino. This forum is not reserved for C or C++ questions only, is it? If so, then the name of the forum should be changed to indicate that.
After all, there is a PIC based Arduino, or at least there used to be. So it might be a bit premature to jump to any conclusions just yet.
I've seen a lot of trolling in my life, but this didn't strike me as that. The OP could have provided some more information like whether he wanted something in C or AVR assembler, but I didn't see anything excessively inappropriate regarding the topic of the post.
The OP could have provided some more information like whether he wanted something in C or AVR assembler, but I didn't see anything excessively inappropriate regarding the topic of the post.
I'm with you on that.... imperfectly phrased question maybe, but no hanging offence.
Thanks Jimbo. I think people should feel welcome to bring anything here if they are trying to port it to the Arduino.
afremont:
He wants to know how to convert that PIC assembler code in the equivalent on the Arduino.
No, he doesn't. This is the original post:
Gates:
I am trying to convert one of my old codes to work on Arduino. My question is how can I convert this code into Arduino. Some guidelines to getting somewhere close to this example please.xorlw ARef
xorlw KRef
btfsc STATUS,Z
goto WriteToSD
There is no mention of PIC. There is no mention of what ARef, KRef, STATUS, Z, or WriteToSD are. The question as it stands is meaningless.
Even given that it is PIC, that doesn't help. Look, I'll grab 4 lines from my MUD client program:
if (iLineLastItemFound == 0)
iLineLastItemFound = parser.m_xmlLine;
HandleLoadException ("Cannot load", e);
AfxThrowArchiveException (CArchiveException::badSchema);
How do I convert that to Arduino? The question is meaningless without context.
How do I convert that to Arduino? The question is meaningless without context.
Agreed, but there's no point having a p!ssing contest over how badly the guy asked the question.
I'm going with my answer, that he can't convert it in the simple sense (as in plug metres into a calculator and get feet out.... plug PIC assembler in and get Arduino-compatible-C out), but he'd be better off defining the purpose of the assembler and then starting new code to meet that same purpose.