Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
genkiyan said:how to program the tris and status bit of pic 16f877? by using c language. thanx!!
genkiyan said:how to program the tris and status bit of pic 16f877? by using c language. thanx!!
Jay.slovak said:Try TRISA = 255;
:lol:
Yep, as always 8)Joel Rainville said:Jay.slovak said:Try TRISA = 255;
:lol:
Hey, not bad Jay, not bad... You've been reading datasheets, don't you? We can tell!... :lol:
TRISBbits.TRISB7=1;
Jay.slovak said:And in case you neet to bit-bang the TRIS register, I believe this should work
Code:TRISBbits.TRISB7=1;
Hmm that sucks, I prefer to use Microchips toolsuits...Exo said:Jay.slovak said:And in case you neet to bit-bang the TRIS register, I believe this should work
Code:TRISBbits.TRISB7=1;
That's in C18, since he's using a 16F877 he is using a 3rd party compiler wich may use completely diffirent names.
Some even dont allow bit manipulation this way and only allow it by AND'ing and OR'ing the byte...
Exo said:That's in C18, since he's using a 16F877 he is using a 3rd party compiler wich may use completely diffirent names.
TRISB7=true or
TRISB.7=false
RA0=1; //produce 5V on RA0, pin 2 of micro
RA0=0; //produce 0V on RA0, pin 2 of micro
Hmm, that's much better than C18 :?Joel Rainville said:It's done like this with the Hi Tech compiler :
Code:RA0=1; //produce 5V on RA0, pin 2 of micro RA0=0; //produce 0V on RA0, pin 2 of micro
Pretty straightforward...
That's true, but it's much harder o do it C18 way (especially for beginner).Exo said:No it isnt.
Using a name for every bit causes massive namespace pollution.
C18's way is much cleaner, by grouping the bits in a bitfield struct...
I agree the names are a bit long though...