PDA

View Full Version : Portb 16F628A



tazntex
- 12th August 2008, 22:56
This may sound like a really dumb question or I have a bad lot of processors, I doubt that but the question is can I do this:

myvar var byte
portb = myvar

And whatever myvar is, really it is a binary number, the ports pins on portb would change to that state.


Thanks

skimask
- 12th August 2008, 23:02
myvar var byte
portb = myvar

As long as all pins on PORTB are set to OUTPUTs, which they're not upon RESET...on most, if not all, PICs, as noted in most, if not all, datasheets, in the 'I/O Ports' section, and as long as said pins are not designated for another use (i.e. PortA, analog vs. digital usage).

Archangel
- 13th August 2008, 00:05
As long as all pins on PORTB are set to OUTPUTs, which they're not upon RESET...on most, if not all, PICs, as noted in most, if not all, datasheets, in the 'I/O Ports' section, and as long as said pins are not designated for another use (i.e. PortA, analog vs. digital usage).

He means yes . . .

mackrackit
- 13th August 2008, 01:26
skimask,
you are starting to sound like a lawyer :D

Darrel Taylor
- 13th August 2008, 01:35
The problem with Lawyers is that you never really know what they said.

See, I thought ski said YES, with "as long as certain conditions were met" added.

But since it can't work with ONLY the code being shown. Maybe his answer was really NO.
<br>

mackrackit
- 13th August 2008, 01:54
It is that little bit of doubt that makes one wonder :)

I need to go find something to do...

tazntex
- 13th August 2008, 03:21
"The problem with Lawyers is that you never really know what they said."
That statement is so true, with that being said Portb is set as outputs:
trisa = %00000010
trisb = %00000000
PORTA = 0
PORTB = 0

The reason why I asked was because in an earlier post using SERIN I can select individual bit
as in :
Portb.0 = myvar.0 ' which is working

but wasn't quite sure about receiving all to my variable and then assigning that data to portb.

Thanks Everyone

skimask
- 13th August 2008, 03:51
A lawyer...Ha! Now that's funny! Lawyers are nothing but overpaid B.S. artists...and should be...ok, nevermind...

The reason I answered the way I did is because, even though it doesn't seem like, there's a lot of useful FUTURE information in there.
So, yes, if a port pin was set to output upon RESET, which it's not, so therefore, the answer is NO, because a condition set forth by the datasheet has not been met.
I rest my case...

mackrackit
- 13th August 2008, 03:53
Here is a good one to study.
http://www.picbasic.co.uk/forum/showthread.php?t=544