Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
|
I am trying to set up an interface with stepper motors. I need a lot of GPIO ports (almost filling the entire MC9S12DG256). I have looked over the PIM reference manual, the CAN reference manual, and a few others, but cannot make ports T, S, M, P, H, and J work in the GPIO mode. The PIM manual states that they should function as GPIO after reset, so I imagined that all I would need to do is to set the direction registers, and then set the ports. However, this is not the case, and I cannot determine the cause. I am fairly new to the HC12, after having used PIC microcontrollers, so I am behind on the registers that are out there. Any help would be appreciated. |
|
|
|
I am trying to set up an interface with stepper motors. I need a lot of GPIO ports ========================= This sounds like a job for a system engineer! You need to list the requirements before you select the components.... I'd like to know how many steppers you want to drive and how fast, and if there are stepper controller cards or driver cards, etc. You could get a couple of I2C stepper controller chips on an I2C bus for example, or maybe you just need a couple of HC595s daisy chained on the spi as an output expander. There might even be a commercial off the shelf module that will do what you want, and we might be able to suggest one, if we knew what it was you really needed. [Non-text portions of this message have been removed] |
|
I use all these ports as mostly GPIO on 2 different products and all I have ever needed to do was write to the data direction registers. Do you have the correct header file for this chip? Internal addresses vary among the different version. If you're using assembler, are you writing 1's for outputs? Perhaps your monitor has re-addressed these registers, or perhaps you have inadvertantly done so. If you're using assembler, remember that... ldaa #255 staa DDRP writes all ones to the DDRP, making all pins outputs, however... ldaa 255 staa DDRP writes the contents of memory location 255 to DDRP, resulting in some unexpected pattern of input/output. Anyway, would like to know how your design turns out. --- In , "ncooper_lynntech" <ncooper_lynntech@y...> wrote: > > I am trying to set up an interface with stepper motors. I need a > lot of GPIO ports (almost filling the entire MC9S12DG256). I have > looked over the PIM reference manual, the CAN reference manual, and > a few others, but cannot make ports T, S, M, P, H, and J work in the > GPIO mode. The PIM manual states that they should function as GPIO > after reset, so I imagined that all I would need to do is to set the > direction registers, and then set the ports. However, this is not > the case, and I cannot determine the cause. I am fairly new to the > HC12, after having used PIC microcontrollers, so I am behind on the > registers that are out there. Any help would be appreciated. |
|
> If you're using assembler, remember that... > > ldd #255 > std DDRP > writes all ones to the DDRP, making all pins outputs, however... Writes all zeros to DDRP and 255 to RDRP :-). Note also that PIC data direction registers are called TRISx. You write zeros to TRISx to make pins outputs. You write ones to HC/HCS12 DDRx to make pins outputs. Edward > ldd 255 > std DDRP > writes the contents of memory location 255 to DDRP, resulting in some > unexpected pattern of input/output. > > Anyway, would like to know how your design turns out. > > Bill Tondreau > http://www.kupercontrols.com > > --- In , "ncooper_lynntech" > <ncooper_lynntech@y...> wrote: >> >> I am trying to set up an interface with stepper motors. I need a >> lot of GPIO ports (almost filling the entire MC9S12DG256). I have >> looked over the PIM reference manual, the CAN reference manual, and >> a few others, but cannot make ports T, S, M, P, H, and J work in > the >> GPIO mode. The PIM manual states that they should function as GPIO >> after reset, so I imagined that all I would need to do is to set > the >> direction registers, and then set the ports. However, this is not >> the case, and I cannot determine the cause. I am fairly new to the >> HC12, after having used PIC microcontrollers, so I am behind on the >> registers that are out there. Any help would be appreciated. |
|
|
|
> > ldd #255 > > std DDRP > > writes all ones to the DDRP, making all pins outputs, however... Right you are, that's exactly the same type of bug I was trying to banish! I noticed that literally just seconds after posting that message, erased the original message, and reposted one with ldd #255 changed to ldaa #255, and std changed to staa. I immediately saw the corrected message on my listing, but I wonder if "erasing" yahoo messages doesn't necessarily erase them for everybody. |
|
|
|
>> > ldd #255 >> > std DDRP >> > writes all ones to the DDRP, making all pins outputs, however... > > Right you are, that's exactly the same type of bug I was trying to > banish! > > I noticed that literally just seconds after posting that message, > erased the original message, and reposted one with ldd #255 changed > to ldaa #255, and std changed to staa. I'm subscribed and do get all messages, even deleted. I thought you sent same message twice and I replied to first one. Please place something at top of revised message next time. Edward > I immediately saw the corrected message on my listing, but I wonder > if "erasing" yahoo messages doesn't necessarily erase them for > everybody. |
|
--- In , "tonalbuilder2002" <twentiethwave@h...> wrote: > I immediately saw the corrected message on my listing, but I wonder > if "erasing" yahoo messages doesn't necessarily erase them for > everybody. Even if you are connected on line, it seems that erasure is usually too late, the mail has flown... Cheers, Theo |
|
|
|
A good reason for deleting or editing would be for archive purpose, to avoid people reading the error repeatedly. I just tried deleting my error posts today and it's cool --- In , "theobee00" <yahoodump2@o...> wrote: > > --- In , "tonalbuilder2002" <twentiethwave@h...> wrote: > > > I immediately saw the corrected message on my listing, but I wonder > > if "erasing" yahoo messages doesn't necessarily erase them for > > everybody. > > Even if you are connected on line, it seems that erasure is usually too late, the mail has flown... > > Cheers, > > Theo |