Tables without retlw on pic16.

Status
Not open for further replies.
Code:
movwf    temp
        addwf    PCL,f
        xorlw    "H"^"e"
        xorlw    "e"^"l"
        xorlw    "l"^"l"
        xorlw    "l"^"o"
        xorlw    "o"^" "
        xorlw    " "^"W"
        xorlw    "W"^"o"
        xorlw    "o"^"r"
        xorlw    "r"^"l"
        xorlw    "l"^"d"
        xorlw    "d"^"!"
        xorlw    "!"
        xorwf    temp,w


Are you saying that if the micro jumps into the first line, the value equivalent to H will be saved in w and all the other instructions will not change this value.
 
Last edited:

As I said in my first post, "whatever value is in W prior to it being executed will be used as an offset into the phrase "Hello World!". "

So, if W contained 4 at the start of the code it will contain "o" at the end of the code.

The following instructions do change the value but it will end up correct. This is why all the xors are needed.

Mike.
 
Last edited:
Are you saying that XOR'ing one letter with the following will result in only the first letter appearing as the result?
 
No. I'm expecting a sumple explunation in Enguish.
At long last I have squeezed the explanation out of you.
I am unfortunately one generation ahead of you and don't have the experience of programming on my side.
We only had paper punch-tape Cobol and Fortran when I went through and the Z-80 was just out.
The skill of a teacher is to explain something at a level that the student understands.
I get 2,000 per day looking at my content (2.3GB) and no-one has yet asked about the complex program you presented. Maybe they understand it fully. And yet they are asking about my simple code.
You have got to remember that only a miniscule number of people understand the level at which you are delivering code. As soon as you write one single instruction that they don't understand, you have lost them.
 
I'm sorry to say that you have some problems which many of us have noticed. You tell us you're an expert and a teacher but your statements, your code, and your behavior (here and on your site) tell us another story.

It's pretty obvious that you don't understand XOR logic and you're unable or unwilling to use the MPLAB simulator (or paper and pencil) to study it and learn it.

I get 2,000 per day looking at my content (2.3GB) and no-one has yet asked about the complex program you presented. Maybe they understand it fully. And yet they are asking about my simple code.
Are you talking about my Up/Down Counter program that you copied onto your site without my permission? The first program of mine that you copied and that you refuse to remove as I have asked? If so, you've got some nerve suggesting that I "presented" it. That's yet another example of your very disturbing behavior.

What do those 2,000 visitors per day ask you about your "simple code" Colin? Do they ask why you don't always use the SFR labels and bit labels? Or why your Up/Down Counter program won't assemble as listed without errors? That's sloppy and shoddy work and I would prefer you spend your time cleaning it up instead of copying my programs and criticizing them on your web site for being "too complex" (in your expert opinion).

You have got to remember that only a miniscule number of people understand the level at which you are delivering code. As soon as you write one single instruction that they don't understand, you have lost them.
It seems more likely to me that as soon as I write one single instruction that you don't undertsand, I've lost you. And then you copy my programs without my permission and display them on your web site and criticize them as being too complex (for you).

What you don't seem to understand Colin is that there are plenty of people with the ability, motivation, and willingness to learn something from my code examples. You just don't seem to be one of them...
 
Last edited:
I don't want to know what is happening, I want to know why you have chosen such a complex way to perform such a simple task.
You still haven't answered my question as to how you generated the values for each instruction and how the letters "H" etc get transferred to a value for the instruction, when the program is assembled.
You certainly have not convinced me that a simple table cannot be produced with comments to show the letter “H,” is not much easier to produce and understand than the lines of code you have produced.
The only comment you made was the fact that the code is not boundary dependent, however most tables can be placed at the top of the program and don’t pose a problem.
However I do agree that Boolean expressions are much more powerful than simple instructions and I have not yet found anyone using them to their fullest in assembly code, to produce games such as TETRIS.
 
Last edited:
Mike (Pommie),

It seems that after all that complaining, and without so much as a "thank you", that Colin (colin55) now believes he understands XOR logic and in-line tables (see below). It's kind of like "out of your mouth" and then "onto his web page". Now if it were me I'd at least say "thank you for the explanation" and "that's neat, would you mind if I put it on my web page and sell it on my CD?".

Regards, Mike

Talking Electronics: The XOR Trick
 
Last edited:
Number, Letters and XOR´s

Hi, all
I´m a newbie in programming. I´m a chemistry teacher with electronics as a hobby. I´ve learned a lot with the XOR discussion in this thread. I took Mike´s serial routine and adapted it to run in a 12F629. It work´s great. However when a try to use the caracter sent as a loop control number, the software get´s wierd. If I send the number 3 using the hyperterminal and try to use this number to control the number of a led blinks I get 50 blinks (maybe 51). It seems to me that I´m sending a caracter and not converting it in the right way. Can someone help me please?
P.S. I´m sorry if I made some language mistakes. English is not my first language.
 
superbrew is correct. The ASCII character '3' is 0x33 (decimal 51). Subtract 0x30 (48) or if you're only using numbers you might XOR the character with 0x30 or '0' and stuff the number into your counter or AND the number with 0x0F and stuff it in your counter;

Code:
;
        call    Get232          ; get character, '1'..'9'
        xorlw   '0'             ; '1'..'9' -> 0x00..0x09
        movwf   counter         ; setup 'counter' var
blink
 
Last edited:
Thanks superbrew and Mike. It is a lot easier than the code that I was trying to do!
Regards from Brasil!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…