is this right
cli()
//doing stuff here will be done with the usb interrupt disabled
// you have 25 clocks to do what you need with a 12mhz
sei()
also what registers are safe? I found this helpful guide
http://www.nongnu.org/avr-libc/user-man ... _reg_usage
under "What registers are used by the C compiler?"
I gathered form this info that a few groups of registers are ok to use., namely(r18-r27, r30-r31):
but when using them my data seems to be a bit random. and some of those registers seem to cause issues when changed.
Assuming I'm using the registers right, what registers can I use? I really need a few 8 bits or possible two 32 bits. Is there any info around here that would show what is available and what data types they are?
another thing I dont understand is how to init these registers with data?
If I do
Code: Select all
register int *result1 asm ("r26")= 0xff ;
register int *result2 asm ("r30")= 0xff ;
I get that data put in there, but I can no longer change them when I do something like..
Code: Select all
asm volatile
(
"in r21, %0\n"// get data from port c
"BST r21, 5 \n"//put the 5th bit
"BLD r26, 0 \n"//into r26 0th bit.
"BST r21, 4 \n"//put the 4th bit
"BLD r30, 0 \n"//into r30 0th bit
: : "I" (_SFR_IO_ADDR(PINC)) );
Te data stays at FF , did I do something wrong?
BTW: I have an atmega 168