Dear all, How to locate the bit I want in ACC register? I supposed to use ACC_7 with regx51.h but it encounters error. Thanks. Bill PS. I am searching for AT89C51.h. Please notice me in case you find it. Thanks.
"you probably don't need to access the accumulator directly if you're writing C" I'd put it stronger: you almost certainly should not access the accumulator directly if you're writing C! "Changing the accumulator directly makes a lot of assumptions about how the compiler generates object code that may not remain true..." In fact, they may not even be true in the first place!
See the include files in your installation directory, typically C:\keil\c51\inc. There are many reg*.h files, one corresponding to each supported 8051 variant. reg51.h has the "base" definitions common to any 8051, including the ACC, so it should suffice. And I'll repeat the earlier comment that you probably don't need to access the accumulator directly if you're writing C. Most likely, that's either a detail you can leave to the compiler, or you should be writing your custom routine in assembler and linking it to the rest of your C code. Changing the accumulator directly makes a lot of assumptions about how the compiler generates object code that may not remain true in the presence of optimization, source changes, or updated compiler versions.
hello mr plz send me <regx51>
hello i want you regx51
Look up "bit-addressable objects" in the Manual
When you write in 'C', you delegate responsibility for register usage to the compiler. You should not be trying to fiddle directly with ACC!
View all questions in Keil forum