PDA

View Full Version : How do you do this in Assembly



ice
- 9th May 2005, 09:02
Hello..
i'm trying to port the "quadrature decoding" program to assembly.
The original thread is over here.

I'm running into a few problems

1>
coverting "new=PORTB & %11000000" to assembly


movf PORTB,W
ANDLW 11000000 ;take in portB ,and with 11000000 and store in "W"
movwf _new ;load into "new" variable


The statement ANDLW 11000000 in assembly is written as ANDLW b'11000000'
However it doesnt compile if i put in ANDLW b'11000000'

2>how do i compare 2 variables "old_val = new_val" in assembly?

Thank you

Dwayne
- 9th May 2005, 15:24
Hello Ice,

Ice>>Hello..i'm trying to port the "quadrature decoding" program to assembly.
The original thread is over here.
I'm running into a few problems<<


99 percent of the folks on this forum use Pic Basic or Pic Basic Pro. Maybe Melanie, Ralph, or Mister-e may get a wild hair and tackle the problem for you, if they have time. People use PBP, so they do not have to mess with the assembly routines. One way how you can find your answer, is look at the detailed Data sheet of your PIC chip you are using. I will show you how to use assembly to assign your Ports... etc. Some data sheets will give you all 32 assembly commands. Called RISC Reduced Instruction S (forgot what the S was Set?) Code.

Its been 15 years since I have messed with assembly...Most of it I have forgot <g>. If you have PBP, you can write the routine, and look at your (PBP MACRO-type) assembly code after a compilation. Or, you can go to compilespot, and do it for free.... Just write the very basic of what you need.

Val1 var byte
Val2 Var byte

...
...
Val1=Portb
if(Val1> Valb) goto .....
end

Compile and look at the assembly.

Realize that it is not TRUE assembly But gives a person a idea via the small subroutines or macros that PBP uses to work with Assembly.



Here is a thread that may help:
http://www.picbasic.co.uk/forum/showthread.php?t=542&highlight=assembly

Dwayne

Luciano
- 9th May 2005, 15:53
Hi Ice,

See new post in thread "decoding quadrature encoders".

Luciano

ice
- 10th May 2005, 06:47
Thanks Dwayne,
I needed the assembly as im using it for an interrrupt program for decoding encoders...
It's a part of this thread
http://www.picbasic.co.uk/forum/showthread.php?t=1552

Thanks Luciano..im working on the code tday