Subject: Help wanted
From: Rotary Engine
Date: 10/9/2009, 3:50 PM
To: AAA Put this in the To box


 I don't suppose we have any Motorola 6800 assembly language programmers
 on here or do we?
 Well, it's been a while, but I've done it. :)
 Bob W.


 Several people have responded.

 Bob White, Matt Prather, Rick and Cary.

 I'll establish a consensus.

 I need some one to read this pdf and set the port direction registers
 up for one A to D in and a PWM out. Also the real time clock should be
set to  8 ms.  Not a trivial task. These chips are getting complicated
because they are  putting in a lot of options. Please comment as much as
possible.

 MC9RS08KA8RM.pdf

 I'll attach the pdf. Sorry people it is rather large.
 --
 I usually limit attachments to one meg or less. I'll only send this
 out only  once.
 You can get more help from here but you will have to sign up and log in.


https://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=RS08KA">http
://www.microsquirt.info/


Paul Lamar



 I use to teach 6800 programming for years to engineers for Motorola.
What do yo need?

 ej neil


We just need the I/O registers configured as per above.
Send well commented ASM source code.

Paul Lamar

Maybe this is relevant.
C. Smith

That is interesting. Good thing we don't need it as we have two timers/PWM already.

Paul Lamar

**********************************************************************
http://www.edn.com/article/CA6699733.html?spacedesc=designideas&industryid=4
4217&nid=4736&rid=4427882

Unused port adds a PWM/analog channel to a microcontroller
Take advantage of unused pins to generate a PWM signal and then filter it into analog.
Vishwas Vaidya, Tata Motors Ltd, Pune, India; Edited by Martin Rowe and Fran Granville -- EDN, 10/8/2009

Low-cost, 8-bit, single-chip microcontrollers are stingy when it comes to on-chip PWM (pulse-width-modulation) resources. The use of a PWM resource often forces a designer to sacrifice a capture/compare or timer channel because the PWM channel shares the same on-chip hardware. This Design Idea describes how you can use an on-chip unused synchronous serial port to generate PWM signals and convert them to a slow-moving analog signal (Figure 1). Many microcontroller-based stand-alone electronic units don’t use the synchronous serial port. Thus, you can use the microcontroller’s baud-rate generator and parallel-to-serial-converter blocks to generate bit patterns to form a 256-bit PWM pattern. You can then filter the PWM output with an RC filter to extract an analog signal (Reference 1). The synchronous communication is devoid of the start and stop bits of asynchronous mode, so the bit pattern can generate long periods of high or low level.

You can generate raw data with a decimal value of 165 using this concept (Figure 2). A PWM-conversion cycle consists of generating 256 bits—that is, 32 bytes. The number of “on” bits corresponds to the value of the raw data to convert into PWM. Hence, for 165 bits as the raw data, 165 bits are on and 91 bits are off. To generate a 165-bit on-period, the first 20 bytes—that is, 160 bits—transmit as 0×ff on-state bytes. The trick lies in judiciously composing the 21st, or transition, byte. This byte has some of its LSBs (least significant bits) as ones and the rest as zeros to form the required length of the on-period. In this case, the circuit needs five more on bits: 160+5=165. Hence, the transition byte should have a 00011111b pattern (byte=0×1f).

Figure 3 illustrates the process in flow-chart form. You can tailor the PWM frequency to your application by selecting a crystal, PLL (phase-locked loop), and baud rate. A simple RC filter can convert the PWM into a slow-moving analog value. Although this idea describes an 8-bit PWM, you can increase or decrease resolution by changing the total bits per PWM cycle. You correspondingly increase or decrease the conversion time.

Listing 1 provides a sample code for illustrating the concept. The code uses the Microchip PIC18F4525, which has a 4-MHz crystal and 10-kHz baud rate for the synchronous serial communication, yielding 10,000/256=39.31 Hz of PWM frequency. You can filter it with a 0.1-sec RC filter, which is sufficient for slow-moving analog signals, such as speed setpoints for motion-control applications. By using a 20-MHz crystal, you can achieve synchronous serial baud rates greater than 1.5 MHz and PWM frequencies of a few kilohertz.


-- 
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site. http://www.rotaryeng.net
Youtube key word UTUBPLEASE
Copyright 1998-2009 All world wide rights reserved.