Forums

ALP for Real Time Clock using timer unit of HC12

Started by alex99 October 25, 2009
HI,

I am implementing an ALP program to implement a real time clock to display
hour,minute,second using features available in a timer unit. Digits have to
displayed on one of the GPIO ports of HC12 micro-controller. 

I do know how to proceed on this in C language but am a newbie in
micro-controllers and assembly programming - was hoping that someone could
point me in the right direction -- perhaps even coded examples that could
serve as a way to better understand it.

Thank you in advance!

	   
					
---------------------------------------		
This message was sent using the comp.arch.embedded web interface on
http://www.EmbeddedRelated.com
On Sun, 25 Oct 2009 16:19:17 -0500, alex99 <alex.xander99@gmail.com> wrote:
> I am implementing an ALP program to implement a real time clock to display > hour,minute,second using features available in a timer unit. Digits have to > displayed on one of the GPIO ports of HC12 micro-controller. > > I do know how to proceed on this in C language but am a newbie in > micro-controllers and assembly programming - was hoping that someone could > point me in the right direction -- perhaps even coded examples that could > serve as a way to better understand it.
First, just as you learned the elements of the "C" language, you will need to learn the elements of "HC12 Assembler"; new language, new words and punctuation. Find a good book. The HC12 has been around for a while, and while I'm not familiar with any particular writer, I'm sure many HC12 books have been written. Start with your local library, your local college library, or even Amazon.com's used book section. Another route would be to dig up a copy of the HC12 architecture and instruction set. Even if you can't locate this (these) at an official Motorola/Freescale site, there should be many old copies running around on the 'web. Second, start by coding your solution in C, then locate an HC12 cross-compiler (e.g. gcc) and generate an HC12 pseudoassembler listing from it. With this listing in front of you, and the HC12 instruction set descrioption handy, work your way through how what you asked for in C "looks" to the HC12 processor. The rest is up to you. You have indicated that you know how to proceed with C, so I won't go into details like what port pins do what, but you'll still need to know how to take your assembler text file and create an executable image file from it, and how to get that image loaded into your HC12. Hope this helps... Frank McKenney -- The thing which keeps life romantic and full of fiery possibilities is the existence of these great plain limitations which force all of use to meet the things we do not like or do not expect. -- G.K. Chesterton: On the Institution of the Family (1905) -- Frank McKenney, McKenney Associates Richmond, Virginia / (804) 320-4887 Munged E-mail: frank uscore mckenney ayut mined spring dawt cahm (y'all)
>On Sun, 25 Oct 2009 16:19:17 -0500, alex99 <alex.xander99@gmail.com>
wrote:
>> I am implementing an ALP program to implement a real time clock to
display
>> hour,minute,second using features available in a timer unit. Digits have
to
>> displayed on one of the GPIO ports of HC12 micro-controller. >> >> I do know how to proceed on this in C language but am a newbie in >> micro-controllers and assembly programming - was hoping that someone
could
>> point me in the right direction -- perhaps even coded examples that
could
>> serve as a way to better understand it. > >First, just as you learned the elements of the "C" language, you >will need to learn the elements of "HC12 Assembler"; new language, >new words and punctuation. Find a good book. > >The HC12 has been around for a while, and while I'm not familiar >with any particular writer, I'm sure many HC12 books have been >written. Start with your local library, your local college library, >or even Amazon.com's used book section. > >Another route would be to dig up a copy of the HC12 architecture >and instruction set. Even if you can't locate this (these) at >an official Motorola/Freescale site, there should be many old >copies running around on the 'web. > >Second, start by coding your solution in C, then locate an HC12 >cross-compiler (e.g. gcc) and generate an HC12 pseudoassembler >listing from it. With this listing in front of you, and the HC12 >instruction set descrioption handy, work your way through how >what you asked for in C "looks" to the HC12 processor. > >The rest is up to you. You have indicated that you know how to >proceed with C, so I won't go into details like what port pins >do what, but you'll still need to know how to take your assembler >text file and create an executable image file from it, and how to >get that image loaded into your HC12. > >Hope this helps... > > >Frank McKenney>
Tank you. The C solution I have in mind is what I found on another thread here: if (RTC_tick>= XX ){ seconds++; RTC_tick = 0; if (seconds>=60){ minutes++; seconds = 0; } if (minutes>=60){ hours++; minutes = 0; } if (hours>=24){ days++; hours = 0; } } Will this be enough to run on a simulator? --------------------------------------- This message was sent using the comp.arch.embedded web interface on http://www.EmbeddedRelated.com
On Sat, 07 Nov 2009 04:26:00 -0600, alex99 wrote:

> Tank you. The C solution I have in mind is what I found on another thread > here: > > if (RTC_tick>= XX ){ > seconds++; > RTC_tick = 0;
Try: RTC_tick -= XX;
On 9 Nov, 23:04, Nobody <nob...@nowhere.com> wrote:
> On Sat, 07 Nov 2009 04:26:00 -0600, alex99 wrote: > > Tank you. The C solution I have in mind is what I found on another thre=
ad
> > here: > > > if (RTC_tick>=3D XX ){ > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0seconds++; > > =A0 =A0 =A0 =A0 =A0 =A0RTC_tick =3D 0; > > Try: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RTC_tick -=3D XX;
Why? Bye Jack
On 11 Nov, 11:22, Jack <jack4...@gmail.com> wrote:
> On 9 Nov, 23:04, Nobody <nob...@nowhere.com> wrote: > > > On Sat, 07 Nov 2009 04:26:00 -0600, alex99 wrote: > > > Tank you. The C solution I have in mind is what I found on another th=
read
> > > here: > > > > if (RTC_tick>=3D XX ){ > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0seconds++; > > > =A0 =A0 =A0 =A0 =A0 =A0RTC_tick =3D 0; > > > Try: > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RTC_tick -=3D XX; > > Why?
ah, ok. Understood. a little bit slow today :P Bye Jack