EmbeddedRelated.com
Forums

LED display

Started by mthem2003 February 18, 2003
Hi,
I am having diffuculty locating sample codes on how to display
results on LEDs using the MC68hc11. I only want the LED to flash on
for 1 and nothing on 0. using 3 pins in portb each one will send 1
or 0 to the equivalent LED.
I would really appreciate it, if you can provide me or direct me to
a code that performs this.

Thank you
mthem2003



Hi,
no need for the "blink" in the project, but Thank you so much for
your reply ( and for the portb message reply as well), i found them
to be really helpful.

:)
mthem2003
--- In , "Nick Reitter, 3rd" <nick@r...>
wrote:
> Hi, Here is how to control a LED in its simplifiest terms.
> First the hardware. Port B requires an inverter (Does not have to
be an
> inverter. Inverters are nicer. ie. A 1 turns the LED on.) driver
to control
> a LED. The LED is in series with a 330 ohm current limiting
resistor and is
> connected between the +5volts and the driver output. The input of
the driver
> goes to Port B. Use a 7416 or 7404to the driver output. The input
of the
> driver goes to Port B. All of this is because port B
cannot "furnish" the
> current required to control a LED. The current is about 16
millamps for a
> LED.
> The code for turning a bit on is:
> ldaa #data
> staa $1004
> If the LED is on bit 0, data = $01
> If the LED is on bit 1, data = $02
> If the LED is on bit 2, data =$04
> If the LED is on bit 3, data = $08
> If the LED is on bit 4, data = $10
> If the LED is on bit 5, data = $20
> If the LED is on bit 6, data = $40
> If the LED is on bit 7, data =$80
> You can of course add the data to control multiple bits.
> To turn all the bits off use:
> clr $1004
> The best way to do turn a bit on without affecting any other bits
is using
> bit manipulation instructions:
> ldx #$1000
> bset $04,x data
> Likewise to turn a bit off without affecting any other bits is
using bit
> manipulation instructions:
> ldx #$1000
> bclr $04,x data
>
> There are other ways to control LEDs connected to Port B, but this
will get
> the job done.
>
> Do you also want to know how to make a LED "blink"?
>
> Nick >
> -----Original Message-----
> From: mthem2003 <mthem2003@y...> [mailto:mthem2003@y...]
> Sent: Tuesday, February 18, 2003 12:36 PM
> To:
> Subject: [m68HC11] LED display
>
> Hi,
> I am having diffuculty locating sample codes on how to display
> results on LEDs using the MC68hc11. I only want the LED to flash on
> for 1 and nothing on 0. using 3 pins in portb each one will send 1
> or 0 to the equivalent LED.
> I would really appreciate it, if you can provide me or direct me to
> a code that performs this.
>
> Thank you
> mthem2003 >
> To unsubscribe from this group, send an email to: >
>
> ">http://docs.yahoo.com/info/terms/


Hi, Here is how to control a LED in its simplifiest terms.
First the hardware. Port B requires an inverter (Does not have to be an
inverter. Inverters are nicer. ie. A 1 turns the LED on.) driver to control
a LED. The LED is in series with a 330 ohm current limiting resistor and is
connected between the +5volts and the driver output. The input of the driver
goes to Port B. Use a 7416 or 7404to the driver output. The input of the
driver goes to Port B. All of this is because port B cannot "furnish" the
current required to control a LED. The current is about 16 millamps for a
LED.
The code for turning a bit on is:
ldaa #data
staa $1004
If the LED is on bit 0, data = $01
If the LED is on bit 1, data = $02
If the LED is on bit 2, data =$04
If the LED is on bit 3, data = $08
If the LED is on bit 4, data = $10
If the LED is on bit 5, data = $20
If the LED is on bit 6, data = $40
If the LED is on bit 7, data =$80
You can of course add the data to control multiple bits.
To turn all the bits off use:
clr $1004
The best way to do turn a bit on without affecting any other bits is using
bit manipulation instructions:
ldx #$1000
bset $04,x data
Likewise to turn a bit off without affecting any other bits is using bit
manipulation instructions:
ldx #$1000
bclr $04,x data

There are other ways to control LEDs connected to Port B, but this will get
the job done.

Do you also want to know how to make a LED "blink"?

Nick
-----Original Message-----
From: mthem2003 <> [mailto:]
Sent: Tuesday, February 18, 2003 12:36 PM
To:
Subject: [m68HC11] LED display

Hi,
I am having diffuculty locating sample codes on how to display
results on LEDs using the MC68hc11. I only want the LED to flash on
for 1 and nothing on 0. using 3 pins in portb each one will send 1
or 0 to the equivalent LED.
I would really appreciate it, if you can provide me or direct me to
a code that performs this.

Thank you
mthem2003
To unsubscribe from this group, send an email to:

">http://docs.yahoo.com/info/terms/