Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | How to use Port P as an output pin?

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

How to use Port P as an output pin? - deniz_kerimoglu - Sep 5 5:27:47 2009

Hi everyone,

I got a simple question. I need to use port p as general purpose output, I need to take 0V or 5V output from any of pp0-pp5 pins? How can I achieve it in C?

Regards.

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: How to use Port P as an output pin? - "justin.lucas134" - Sep 5 8:26:02 2009

You will have to configure the DDRP (Data Directional Register P) to output. Pending on the HC12 you are using, you will have to set the bits [0-7] of the DDRP address to logic 1. Not sure how to do it in C, but I have seen examples in this group on how to do that.

Good Luck

Justin

--- In 6...@yahoogroups.com, "deniz_kerimoglu" wrote:
>
> Hi everyone,
>
> I got a simple question. I need to use port p as general purpose output, I need to take 0V or 5V output from any of pp0-pp5 pins? How can I achieve it in C?
>
> Regards.
>
------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: How to use Port P as an output pin? - Tom Almy - Sep 5 9:45:10 2009

There will be a header file that defines the port registers which you
use as unsigned char or in some cases unsigned short variables. What
you would write in assembler as:

movb #$3f DDRP
movb data PTP

you write in C as:

DDRP = 0x3f;
PTP = data;

Tom Almy
Tualatin, Oregon USA
Internet: t...@almy.us
Website: almy.us

On Sep 5, 2009, at 2:27 AM, deniz_kerimoglu wrote:

> Hi everyone,
>
> I got a simple question. I need to use port p as general purpose
> output, I need to take 0V or 5V output from any of pp0-pp5 pins? How
> can I achieve it in C?
>
> Regards.

------------------------------------



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

RE: Re: How to use Port P as an output pin? - jpdi - Sep 6 4:05:09 2009

How, it's quite easy in C !!!

If you want to put all bits of port P as output, just write :
DDRP =3D 0xff;

And to write datas on port P :

char c;
.../...
PORTP =3D c;

This suppose DDRP and PORTP are defined in your include file corresponding
to your processor. For 9s12dp256 and 9s12xdp512 :

This is in the very beginning of mc=E7S&=E9dp256.h
#define _IO_BASE 0
#define _ADDR(off) (unsigned char volatile *)(_IO_BASE + off)
#define _P(off) *(unsigned char volatile *)(_IO_BASE + off)
#define _LP(off) *(unsigned short volatile *)(_IO_BASE + off)

.../...
And this is how the P port is defined in the same .h file :
#define PORTP PTP
#define PTP _P(0x0258)
.../...
#define DDRP _P(0x025A) // Data Direction Register

That means, in fine, PORTP and DDRP are defined as below :
#define PORT *(unsigned char volatile *) 0x0258
#define DDRP *(unsigned char volatile *) 0x025A

Hope this helps.
Joel
-----Message d'origine-----
De=A0: 6...@yahoogroups.com [mailto:6...@yahoogroups.com] De la part de
justin.lucas134
Envoy=E9=A0: samedi 5 septembre 2009 14:26
=C0=A0: 6...@yahoogroups.com
Objet=A0: [68HC12] Re: How to use Port P as an output pin?

You will have to configure the DDRP (Data Directional Register P) to output=
.
Pending on the HC12 you are using, you will have to set the bits [0-7] of
the DDRP address to logic 1. Not sure how to do it in C, but I have seen
examples in this group on how to do that.

Good Luck

Justin

--- In 6...@yahoogroups.com, "deniz_kerimoglu"
wrote:
>
> Hi everyone,
>=20
> I got a simple question. I need to use port p as general purpose output, =
I
need to take 0V or 5V output from any of pp0-pp5 pins? How can I achieve it
in C?
>=20
> Regards.
>
------------------------------------



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Re: How to use Port P as an output pin? - =?ISO-8859-9?Q?Deniz_KER=DDMO=D0LU?= - Sep 6 7:40:33 2009

Thanks everyone it works!
[Non-text portions of this message have been removed]

------------------------------------



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )