View previous topic :: View next topic |
Author |
Message |
ntype
Joined: 01 Nov 2007 Posts: 9
|
Reading Port B |
Posted: Mon Dec 03, 2007 8:13 am |
|
|
I'm using an 18f2520 PIC and would like to read the whole of port B. Ive tried to read using the following code within main()
portb = get_tris_b();
The read does not work. Is there additional port setup required? I will post my source when i get home if required. |
|
 |
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Mon Dec 03, 2007 9:41 am |
|
|
with the get_tris_b(); function you will get the setting of the TRIS register of port B, not port B itself.
You can try the input_b(); function for this purpose.
Hope this helps |
|
 |
Guest
|
|
Posted: Mon Dec 03, 2007 1:23 pm |
|
|
Foppie wrote: | with the get_tris_b(); function you will get the setting of the TRIS register of port B, not port B itself.
You can try the input_b(); function for this purpose.
Hope this helps |
ah i see. input_b() works fine. thanks foppi, u rock! |
|
 |
|