View previous topic :: View next topic |
Author |
Message |
giustraman
Joined: 11 Jun 2007 Posts: 25
|
access into a register |
Posted: Mon Oct 12, 2009 2:39 am |
|
|
How can i get access into a register/bit?? |
|
|
andyfraser
Joined: 04 May 2004 Posts: 47 Location: UK
|
|
|
giustraman
Joined: 11 Jun 2007 Posts: 25
|
Read, not write.. |
Posted: Mon Oct 12, 2009 3:30 am |
|
|
I need to read a bit of a register, for example the bit n°1 of ADCONO register (address: 0x1F)...How can I do it?? Thanks... |
|
|
andyfraser
Joined: 04 May 2004 Posts: 47 Location: UK
|
Read, not write.. |
Posted: Mon Oct 12, 2009 3:34 am |
|
|
Well to me it would seem pretty obvious from the link I sent !
In Ronald's example he writes to a bit using GIE = 1 so to read you can do if ( GIE == 1 ). You need to set up a #byte for ADCON0 and a #bit for the bit you want to read.
Andy |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1937 Location: Norman, OK
|
|
Posted: Mon Oct 12, 2009 6:08 am |
|
|
Expanding on what andyfraser said, you really should take time to read the manual. See #bit in the pre-processor section of the manual. It shows how to define a register bit reference.
In the link he cited, rnielsen (Ron) provides a great example that would answer your question if you would just take a look. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|