Go Down

Topic: From Registers to Vars (Read 713 times) previous topic - next topic

elico

Hi all

How transferring values of registers mentioned in assembly code to vars mentioned in C code in the same sketch .

The assembly code is embedded in the C code with asm: clause .

Hope I am clear .

Elico

PaulS

Quote
Hope I am clear .

Without posting code, no.

elico

very general code ..

main()
{
int abc ;

asm:
var1 = some rgister ;
end asm:

abc = var1 ;
}



James C4S

int pinValues = PINSA;

That's C-code to read the register PINSA and store it in an integer called "pinsValue".
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

elico

thanks

what if I need to deal with specific bits of that register value in the C code level ?

Elico

PaulS

Quote
what if I need to deal with specific bits of that register value in the C code level ?

You have our permission to do that.

James C4S


what if I need to deal with specific bits of that register value in the C code level ?


Either the same way you would in assembly, with bit masking or using the functions bitRead() and bitWrite().  (those are part of the Ardinuno libraries, and found on the language reference page)
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy