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 | PORTP Question

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

PORTP Question - a92651delgado - Nov 19 13:19:48 2008

I'm writing a program to output a stair step waveform from VoutA. How
do I tell PORTP to output 2 volts etc.? (For MC68HC12)

[code]
#include "d:\miniide\hc12.inc"

org $1000
ldaa #$FF
staa DDRP ; configure PORTP for output
ldaa #$6F
staa DDRCAN ; configure PCAN6..PCAN5 for output
bclr PORTCAN,$20 ; select VOUTA output

xx xxxxx ; need to know how to output 0 volts
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
bset PORTCAN,$40 ; "
jsr delay

xx xxxxx ; need to know how to output 2 volts
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
bset PORTCAN,$40 ;
jsr delay

xx xxxxx ; need to know how to output 4 volts
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
bset PORTCAN,$40 ;
jsr delay

end
[/code]
------------------------------------



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


Re: PORTP Question - Nix Knacks - Nov 19 18:28:25 2008

You can't specify an output voltage from a port. The port will always
output +5V when high and GND when low.
The only thing I can think of to accomplish your goal...

Is to maybe use another port and a series of relays and resistors to set up
multiple levels of voltage dividers. That's just a preliminary idea...there
may be other ways to accomplish your goal as well.

Nick P.

On Wed, Nov 19, 2008 at 10:19 AM, a92651delgado wrote:

> I'm writing a program to output a stair step waveform from VoutA. How
> do I tell PORTP to output 2 volts etc.? (For MC68HC12)
>
> [code]
> #include "d:\miniide\hc12.inc"
>
> org $1000
> ldaa #$FF
> staa DDRP ; configure PORTP for output
> ldaa #$6F
> staa DDRCAN ; configure PCAN6..PCAN5 for output
> bclr PORTCAN,$20 ; select VOUTA output
>
> xx xxxxx ; need to know how to output 0 volts
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> bset PORTCAN,$40 ; "
> jsr delay
>
> xx xxxxx ; need to know how to output 2 volts
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay
>
> xx xxxxx ; need to know how to output 4 volts
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay
>
> end
> [/code]
>
>
>
[Non-text portions of this message have been removed]
------------------------------------

______________________________
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: PORTP Question - Steve Letkeman - Nov 19 18:44:13 2008

You can output a PWM signal on port P and then use an external
resistor and capacitor to smooth it into a pseudo analog output. This
means that a 50% pwm signal between 0 and 5 volts is 2.5volts
on average.
Nix Knacks wrote:
>
> You can't specify an output voltage from a port. The port will always
> output +5V when high and GND when low.
> The only thing I can think of to accomplish your goal...
>
> Is to maybe use another port and a series of relays and resistors to
> set up
> multiple levels of voltage dividers. That's just a preliminary
> idea...there
> may be other ways to accomplish your goal as well.
>
> Nick P.
>
> On Wed, Nov 19, 2008 at 10:19 AM, a92651delgado > > wrote:
>
> > I'm writing a program to output a stair step waveform from VoutA. How
> > do I tell PORTP to output 2 volts etc.? (For MC68HC12)
> >
> > [code]
> > #include "d:\miniide\hc12.inc"
> >
> > org $1000
> > ldaa #$FF
> > staa DDRP ; configure PORTP for output
> > ldaa #$6F
> > staa DDRCAN ; configure PCAN6..PCAN5 for output
> > bclr PORTCAN,$20 ; select VOUTA output
> >
> > xx xxxxx ; need to know how to output 0 volts
> > bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> > bset PORTCAN,$40 ; "
> > jsr delay
> >
> > xx xxxxx ; need to know how to output 2 volts
> > bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> > bset PORTCAN,$40 ;
> > jsr delay
> >
> > xx xxxxx ; need to know how to output 4 volts
> > bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> > bset PORTCAN,$40 ;
> > jsr delay
> >
> > end
> > [/code]
> >
> >
> > [Non-text portions of this message have been removed]
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.549 / Virus Database: 270.9.7/1799 - Release Date: 19/11/2008 8:58 AM
>
------------------------------------

______________________________
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: PORTP Question - Anders Friberg - Nov 19 19:15:08 2008



> -----Original Message-----
> From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com]
> On Behalf Of a92651delgado
> Sent: Wednesday, November 19, 2008 7:20 PM
> To: 6...@yahoogroups.com
> Subject: [68HC12] PORTP Question
>
> I'm writing a program to output a stair step waveform from VoutA. How
> do I tell PORTP to output 2 volts etc.? (For MC68HC12)
>
> [code]
> #include "d:\miniide\hc12.inc"
>
> org $1000
> ldaa #$FF
> staa DDRP ; configure PORTP for output
> ldaa #$6F
> staa DDRCAN ; configure PCAN6..PCAN5 for output
> bclr PORTCAN,$20 ; select VOUTA output
>
> xx xxxxx ; need to know how to
> output 0 volts
> bclr PORTCAN,$40 ; generate a rising edge on
> PORTCAN6 pin
> bset PORTCAN,$40 ; "
> jsr delay
>
> xx xxxxx ; need to know how to
> output 2 volts
> bclr PORTCAN,$40 ; generate a rising edge on
> PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay
>
> xx xxxxx ; need to know how to
> output 4 volts
> bclr PORTCAN,$40 ; generate a rising edge on
> PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay
>
> end
> [/code]
>

If you check the lecture note 7 :) last page:

http://www.ece.stevens-tech.edu/~ymeng/courses/CPE390/notes/lecture_note7.pd
f

you see that writing a value to the 8-bit output port PORTP (which is
connected to a da converter) generates a voltage proportional to the value
in PORTP.

So xx xxxxx = LDAA #n, STAA PORTP

Where number n = 255 will probably give ca 5V etc.

>
> ------------------------------------



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

Re: PORTP Question - a92651delgado - Nov 19 22:09:13 2008

Thanks a lot, I think I understand. I've updated the program to what I
think you mean, is this correct? I want is a stair step starting with
0 volts for 1 ms, then jump to 2 v for 1 ms, then jump to 4 v for 1ms.
The sub routine 'delay' is a 1 ms delay.

#include "d:\miniide\hc12.inc"

org $1000
ldaa #$FF
staa DDRP ; configure PORTP for output
ldaa #$6F
staa DDRCAN ; configure PCAN6..PCAN5 for output
bclr PORTCAN,$20 ; select VoutA output

ldaa #0 ; output 0 volts
staa PORTP ; store 0 volts for PORTP
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin to
transfer data
bset PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin to
transfer data "
jsr delay ; set 1ms time width

ldaa #102 ; output 2 volts
staa PORTP ; store 2 volts for PORTP
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
bset PORTCAN,$40 ;
jsr delay ; set 1ms time width

ldaa #204 ; output 4 volts
staa PORTP ; store 4 volts for PORTP
bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
bset PORTCAN,$40 ;
jsr delay ; set 1ms time width

end
--- In 6...@yahoogroups.com, "Anders Friberg"
wrote:
>
> > -----Original Message-----
> > From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com]
> > On Behalf Of a92651delgado
> > Sent: Wednesday, November 19, 2008 7:20 PM
> > To: 6...@yahoogroups.com
> > Subject: [68HC12] PORTP Question
> >
> > I'm writing a program to output a stair step waveform from VoutA. How
> > do I tell PORTP to output 2 volts etc.? (For MC68HC12)
> >
> > [code]
> > #include "d:\miniide\hc12.inc"
> >
> > org $1000
> > ldaa #$FF
> > staa DDRP ; configure PORTP for output
> > ldaa #$6F
> > staa DDRCAN ; configure PCAN6..PCAN5 for output
> > bclr PORTCAN,$20 ; select VOUTA output
> >
> > xx xxxxx ; need to know how to
> > output 0 volts
> > bclr PORTCAN,$40 ; generate a rising edge on
> > PORTCAN6 pin
> > bset PORTCAN,$40 ; "
> > jsr delay
> >
> > xx xxxxx ; need to know how to
> > output 2 volts
> > bclr PORTCAN,$40 ; generate a rising edge on
> > PORTCAN6 pin
> > bset PORTCAN,$40 ;
> > jsr delay
> >
> > xx xxxxx ; need to know how to
> > output 4 volts
> > bclr PORTCAN,$40 ; generate a rising edge on
> > PORTCAN6 pin
> > bset PORTCAN,$40 ;
> > jsr delay
> >
> > end
> > [/code]
> > If you check the lecture note 7 :) last page:
http://www.ece.stevens-tech.edu/~ymeng/courses/CPE390/notes/lecture_note7.pd
> f
>
> you see that writing a value to the 8-bit output port PORTP (which is
> connected to a da converter) generates a voltage proportional to the
value
> in PORTP.
>
> So xx xxxxx = LDAA #n, STAA PORTP
>
> Where number n = 255 will probably give ca 5V etc.
>
> >
> > ------------------------------------
> >
> >



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

Re: Re: PORTP Question - Nix Knacks - Nov 19 22:45:45 2008

That's really neat, I wasn't aware of the da converter at all...I need to
study up more.

On Wed, Nov 19, 2008 at 7:09 PM, a92651delgado wrote:

> Thanks a lot, I think I understand. I've updated the program to what I
> think you mean, is this correct? I want is a stair step starting with
> 0 volts for 1 ms, then jump to 2 v for 1 ms, then jump to 4 v for 1ms.
> The sub routine 'delay' is a 1 ms delay.
> #include "d:\miniide\hc12.inc"
>
> org $1000
> ldaa #$FF
> staa DDRP ; configure PORTP for output
> ldaa #$6F
> staa DDRCAN ; configure PCAN6..PCAN5 for output
> bclr PORTCAN,$20 ; select VoutA output
>
> ldaa #0 ; output 0 volts
> staa PORTP ; store 0 volts for PORTP
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin to
> transfer data
> bset PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin to
> transfer data "
> jsr delay ; set 1ms time width
>
> ldaa #102 ; output 2 volts
> staa PORTP ; store 2 volts for PORTP
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay ; set 1ms time width
>
> ldaa #204 ; output 4 volts
> staa PORTP ; store 4 volts for PORTP
> bclr PORTCAN,$40 ; generate a rising edge on PORTCAN6 pin
> bset PORTCAN,$40 ;
> jsr delay ; set 1ms time width
>
> end
>
> --- In 6...@yahoogroups.com <68HC12%40yahoogroups.com>, "Anders Friberg"
>
> wrote:
>
> >
> >
> >
> > > -----Original Message-----
> > > From: 6...@yahoogroups.com <68HC12%40yahoogroups.com> [mailto:
> 6...@yahoogroups.com <68HC12%40yahoogroups.com>]
> > > On Behalf Of a92651delgado
> > > Sent: Wednesday, November 19, 2008 7:20 PM
> > > To: 6...@yahoogroups.com <68HC12%40yahoogroups.com>
> > > Subject: [68HC12] PORTP Question
> > >
> > > I'm writing a program to output a stair step waveform from VoutA. How
> > > do I tell PORTP to output 2 volts etc.? (For MC68HC12)
> > >
> > > [code]
> > > #include "d:\miniide\hc12.inc"
> > >
> > > org $1000
> > > ldaa #$FF
> > > staa DDRP ; configure PORTP for output
> > > ldaa #$6F
> > > staa DDRCAN ; configure PCAN6..PCAN5 for output
> > > bclr PORTCAN,$20 ; select VOUTA output
> > >
> > > xx xxxxx ; need to know how to
> > > output 0 volts
> > > bclr PORTCAN,$40 ; generate a rising edge on
> > > PORTCAN6 pin
> > > bset PORTCAN,$40 ; "
> > > jsr delay
> > >
> > > xx xxxxx ; need to know how to
> > > output 2 volts
> > > bclr PORTCAN,$40 ; generate a rising edge on
> > > PORTCAN6 pin
> > > bset PORTCAN,$40 ;
> > > jsr delay
> > >
> > > xx xxxxx ; need to know how to
> > > output 4 volts
> > > bclr PORTCAN,$40 ; generate a rising edge on
> > > PORTCAN6 pin
> > > bset PORTCAN,$40 ;
> > > jsr delay
> > >
> > > end
> > > [/code]
> > >
> >
> > If you check the lecture note 7 :) last page:
> >
> > http://www.ece.stevens-tech.edu/~ymeng/courses/CPE390/notes/lecture_note7.pd
> > f
> >
> > you see that writing a value to the 8-bit output port PORTP (which is
> > connected to a da converter) generates a voltage proportional to the
> value
> > in PORTP.
> >
> > So xx xxxxx = LDAA #n, STAA PORTP
> >
> > Where number n = 255 will probably give ca 5V etc.
> >
> > >
> > > ------------------------------------
> > >
> > >



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

RE: Re: PORTP Question - Rob Mora - Nov 19 23:00:54 2008

There *isn't* a dac on the mcu, the example given assumed you had one (a
chip from analog devices in the example) connected to port P, but I'm not
really sure that applies to the original question.

In fact, it probably doesn't apply at all. The original poster should note
that and either add something or take a look at one of the other examples
brought up (maybe the PWM example with an RC filter?)

_____

From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com] On Behalf Of
Nix Knacks
Sent: November 19, 2008 10:46 PM
To: 6...@yahoogroups.com
Subject: Re: [68HC12] Re: PORTP Question

That's really neat, I wasn't aware of the da converter at all...I need to
study up more.

On Wed, Nov 19, 2008 at 7:09 PM, a92651delgado net> wrote:

> Thanks a lot, I think I understand. I've updated the program to what I
> think you mean, is this correct? I want is a stair step starting with
> 0 volts for 1 ms, then jump to 2 v for 1 ms, then jump to 4 v for 1ms.
> The sub routine 'delay' is a 1 ms delay.

[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 )

RE: Re: PORTP Question - Anders Friberg - Nov 20 6:20:16 2008

There is no dac on the mcu but connected. Please see the schematic in the
pdf from earlier mail, page 36.

This must also be the actual hardware judging from the original poster's use
of the strobes on PORTCAN6 pin and also the use of term VOUTA which is the
dac output.

To state that this does not apply is to say that he o.p. copied some
hardware specific firmware from one design and expected it to work on a
totally different hardware but I don't think that is the case :)

Anders
> -----Original Message-----
> From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com]
> On Behalf Of Rob Mora
> Sent: Thursday, November 20, 2008 5:00 AM
> To: 6...@yahoogroups.com
> Subject: RE: [68HC12] Re: PORTP Question
>
> There *isn't* a dac on the mcu, the example given assumed you
> had one (a
> chip from analog devices in the example) connected to port P,
> but I'm not
> really sure that applies to the original question.
>
>
>
> In fact, it probably doesn't apply at all. The original
> poster should note
> that and either add something or take a look at one of the
> other examples
> brought up (maybe the PWM example with an RC filter?)
>
>
>
> _____
>
> From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com]
> On Behalf Of
> Nix Knacks
> Sent: November 19, 2008 10:46 PM
> To: 6...@yahoogroups.com
> Subject: Re: [68HC12] Re: PORTP Question
>
>
>
> That's really neat, I wasn't aware of the da converter at
> all...I need to
> study up more.
>
> On Wed, Nov 19, 2008 at 7:09 PM, a92651delgado > net> wrote:
>
> > Thanks a lot, I think I understand. I've updated the
> program to what I
> > think you mean, is this correct? I want is a stair step
> starting with
> > 0 volts for 1 ms, then jump to 2 v for 1 ms, then jump to 4
> v for 1ms.
> > The sub routine 'delay' is a 1 ms delay.
>
> [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 )