EmbeddedRelated.com
Forums

68HC11 PORT B

Started by john January 24, 2006
Hi,

I am having problems with  the port B. Its an output port and I am
writing the whole port. My code is as follows

ORG 2000
LDAA  $# FF
STAA  $1004

Now, if I write 00 hex  or FF to theport. The port is always floating.
I tried pull ups and pull downs but no difference. Please advice.
Thanks

Regards
John

In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, 
conphiloso@hotmail.com says...
> Hi, > > I am having problems with the port B. Its an output port and I am > writing the whole port. My code is as follows > > ORG 2000 > LDAA $# FF
Try LDAA #$0ff
> STAA $1004 > > Now, if I write 00 hex or FF to theport. The port is always floating. > I tried pull ups and pull downs but no difference. Please advice.
"James Beck" <jim@reallykillersystems.com> schreef in bericht 
news:MPG.1e400edf364e9b3989c14@news.west.earthlink.net...
> In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, > conphiloso@hotmail.com says... >> Hi, >> >> I am having problems with the port B. Its an output port and I am >> writing the whole port. My code is as follows >> >> ORG 2000 >> LDAA $# FF > > Try LDAA #$0ff
That's one step forward. (did your assembler not splutter at the $#FF?) More important yet: at power up, all ports are configured as inputs. So before they can serve as outputs, you must tell them to become outputs. Do this by writing 1 to the relative bits in the corresponding data direction register. On an 6812 it is called DDRB, suppose it's the same on 6811. Since you want ALL bits to be outputs, write #$FF to the DDRB.
In article <43d659f0$0$29459$ba620e4c@news.skynet.be>, 
adelcoGENE@zeverSKYNET.BE says...
> > "James Beck" <jim@reallykillersystems.com> schreef in bericht > news:MPG.1e400edf364e9b3989c14@news.west.earthlink.net... > > In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, > > conphiloso@hotmail.com says... > >> Hi, > >> > >> I am having problems with the port B. Its an output port and I am > >> writing the whole port. My code is as follows > >> > >> ORG 2000 > >> LDAA $# FF > > > > Try LDAA #$0ff > > That's one step forward. > (did your assembler not splutter at the $#FF?) > > More important yet: at power up, all ports are configured as inputs. > So before they can serve as outputs, you must tell them to > become outputs. Do this by writing 1 to the relative bits in the > corresponding data direction register. On an 6812 it is called DDRB, > suppose it's the same on 6811. > Since you want ALL bits to be outputs, write #$FF to the DDRB. > > >
No DDRB, it is an output only. At least on all of the variants I have on hand.
Hi,

The port B is an ouput port. why do I need to set its direction ?

Please advice!

Thanks
John
James Beck wrote:
> In article <43d659f0$0$29459$ba620e4c@news.skynet.be>, > adelcoGENE@zeverSKYNET.BE says... > > > > "James Beck" <jim@reallykillersystems.com> schreef in bericht > > news:MPG.1e400edf364e9b3989c14@news.west.earthlink.net... > > > In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, > > > conphiloso@hotmail.com says... > > >> Hi, > > >> > > >> I am having problems with the port B. Its an output port and I am > > >> writing the whole port. My code is as follows > > >> > > >> ORG 2000 > > >> LDAA $# FF > > > > > > Try LDAA #$0ff > > > > That's one step forward. > > (did your assembler not splutter at the $#FF?) > > > > More important yet: at power up, all ports are configured as inputs. > > So before they can serve as outputs, you must tell them to > > become outputs. Do this by writing 1 to the relative bits in the > > corresponding data direction register. On an 6812 it is called DDRB, > > suppose it's the same on 6811. > > Since you want ALL bits to be outputs, write #$FF to the DDRB. > > > > > > > No DDRB, it is an output only. > At least on all of the variants I have on hand.
In article <1138125287.812767.71340@g43g2000cwa.googlegroups.com>, 
conphiloso@hotmail.com says...

TOP POST FIXED

James Beck wrote:
> In article <43d659f0$0$29459$ba620e4c@news.skynet.be>, > adelcoGENE@zeverSKYNET.BE says... > > > > "James Beck" <jim@reallykillersystems.com> schreef in bericht > > news:MPG.1e400edf364e9b3989c14@news.west.earthlink.net... > > > In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, > > > conphiloso@hotmail.com says... > > >> Hi, > > >> > > >> I am having problems with the port B. Its an output port and I am > > >> writing the whole port. My code is as follows > > >> > > >> ORG 2000 > > >> LDAA $# FF > > > > > > Try LDAA #$0ff > > > > That's one step forward. > > (did your assembler not splutter at the $#FF?) > > > > More important yet: at power up, all ports are configured as inputs. > > So before they can serve as outputs, you must tell them to > > become outputs. Do this by writing 1 to the relative bits in the > > corresponding data direction register. On an 6812 it is called DDRB, > > suppose it's the same on 6811. > > Since you want ALL bits to be outputs, write #$FF to the DDRB. > > > > > > > No DDRB, it is an output only. > At least on all of the variants I have on hand. > Hi, > > The port B is an ouput port. why do I need to set its direction ? > > Please advice! > > >
I think that's what I said........ BTW, since it is an output only port it shouldn't be "floating" either. JIm
Hi,
any solutions!

John

"john" <conphiloso@hotmail.com> schreef in bericht 
news:1138125287.812767.71340@g43g2000cwa.googlegroups.com...
> Thanks > John > James Beck wrote: >> In article <43d659f0$0$29459$ba620e4c@news.skynet.be>, >> adelcoGENE@zeverSKYNET.BE says... >> > >> > "James Beck" <jim@reallykillersystems.com> schreef in bericht >> > news:MPG.1e400edf364e9b3989c14@news.west.earthlink.net... >> > > In article <1138114456.450664.271660@f14g2000cwb.googlegroups.com>, >> > > conphiloso@hotmail.com says... >> > >> Hi, >> > >> >> > >> I am having problems with the port B. Its an output port and I am >> > >> writing the whole port. My code is as follows >> > >> >> > >> ORG 2000 >> > >> LDAA $# FF >> > > >> > > Try LDAA #$0ff >> > >> > That's one step forward. >> > (did your assembler not splutter at the $#FF?) >> > >> > More important yet: at power up, all ports are configured as inputs. >> > So before they can serve as outputs, you must tell them to >> > become outputs. Do this by writing 1 to the relative bits in the >> > corresponding data direction register. On an 6812 it is called DDRB, >> > suppose it's the same on 6811. >> > Since you want ALL bits to be outputs, write #$FF to the DDRB. >> > >> > >> > >> No DDRB, it is an output only. >> At least on all of the variants I have on hand. > > The port B is an ouput port. why do I need to set its direction ?
That is exactly what James was saying. It is I that was mistaken - not knowing the 6811 I assumed it would behave like the 6812 I do have experience with.
> Please advice!
Do not top post Seriously though, I can only assume the problem is in your syntax (as was already suggested): you wrote $#FF where it should have been #$FF So I repeat my question: did your assembler accept that phrase? What does the assembly listing show? KA
"James Beck" <jim@reallykillersystems.com> schreef in bericht 
news:MPG.1e4034b094788da2989c18@news.west.earthlink.net...
> In article <1138125287.812767.71340@g43g2000cwa.googlegroups.com>, > conphiloso@hotmail.com says... > > TOP POST FIXED > > James Beck wrote: >> In article <43d659f0$0$29459$ba620e4c@news.skynet.be>, >> adelcoGENE@zeverSKYNET.BE says... >> > >> > Since you want ALL bits to be outputs, write #$FF to the DDRB. >> > >> > >> > >> No DDRB, it is an output only. >> At least on all of the variants I have on hand. >> Hi, >> >> The port B is an ouput port. why do I need to set its direction ? >> >> Please advice! >> >> >> > I think that's what I said........ > BTW, since it is an output only port it shouldn't be "floating" either.
This "floating" bit confirmed my idea that it was configured as an input
Hi,

I do not know how not to top post. please advice. I tried both syntaxs
the result is same.

John