PIC ASM - Hint needed

Sep 05, 2005 3 Replies

Hi, I'm porting some C code written for Hitech PIC C Compiler; my target is AVR. unfortunately, there are some asm directives which I don't understand (they are probably related to PIC architecturee, which I don't know):



rlf _aux,w rlf _Buffer,f rlf _Buffer+1,f rlf _Buffer+2,f rlf _Buffer+3,F



Buffer is a 4-bytes vector, aux is an unsigned char variable; I guess w,f and F are PIC registers; can anyone point to me some asm directives list for PIC or just give me some hint? thanks


Capoccetta

Those are not directives, they are assembly instructions.

Download a datasheet for the PIC you are porting it from and you'll get a concise summary of the instruction set and an explanation of the architecture. If you need more (you shouldn't), download the approprate reference manual.

rlf = rotate left f through carry

w and f determine the destination of the instruction-- w is the accumulator of the PIC, f is a ram location ('file register'). It's a single bit in the instruction opcode.

Note that the fragment you've quoted above does not modify _aux, only the 4 bytes of _Buffer.._Buffer+3 (it left shifts bit 7 of _aux into the 32 bit buffer, and bit 7 of _Buffer+3 ends up in the carry).

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

In C it could be expressed as:

unsigned char aux; unsigned char Buffer[4];

*(long *)Buffer

Hi, thanks to everyboy, I think I've found equivalent AVR instructions; also, I've translated them in C; in the next days I'll see if my Keeloq decoder works...

Capoccetta

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required