Parallel Port on 9S08AW60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parallel Port on 9S08AW60

2,810 Views
seanmac
Contributor I
I am currently running a 9S08AW60 at 40MHz (20MHz Bus speed). What is the fastest rate at which I can toggle one of the PORT pins?
 
Cheers
Sean
 
Labels (1)
0 Kudos
6 Replies

474 Views
Alban
Senior Contributor II
Hello,

I think it's Bus/3 or Bus/4
The C line would be PORTB ^= PORTB;
You can toggle up to Bus/2 for a TIMER.

Alban.
0 Kudos

474 Views
peg
Senior Contributor IV
The question needs further qualification before a realistic answer can be given.
 
Programmatically?
Only one pin of a port.
Using a module (timer)
COP enabled
etc
 
0 Kudos

474 Views
Alban
Senior Contributor II
Well, yes I would tend to agree.
But on the other hand, an open question means you can answer pretty much what you want.
For instance when PORT was mentioned, I biased my answer to suggest the TIMER.

Give it a go Peg, it's my training for politics :smileytongue:

I would push even further. On devices with ECLK available, it is possible to output exactly the bus speed.

Oh, and if you use the SCI, the maximum is Bus Speed/16. This is because the bits are sampled 16 times to make up the fact that no clock signal is available on SCI lines.

My answers are now: Bus; Bus/2; Bus/4 and Bus/16.
The COP would be nasty in my previous C code suggested at it would also make the RESET pin toggle.

Cheers,
Alban. {I'm in week end}
0 Kudos

474 Views
peg
Senior Contributor IV
Hi Alban,
 
I did actually give this some thought, but came up with so many ideas with so many limitations blah blah.
In the end I gave up.
 
If use a pin set to GPIO and then need to drive from programme, BSET uses too many cycles.
ROL etc are fast but affect all the pins in the port. But this wasn't excluded in the contest spec.
You could set the SPI to buss/2 then write rubbish to SCID. This gives a bit of time to handle a COP etc
Maybe qualifies for programmatically as well?
 
Whooo getting head spins again, I give up.
 
0 Kudos

474 Views
Wings
Contributor I
I had to do this once on an older 705 chip via my code, to drive a sonar transducer for several cycles. I think it went something like:
lda #%00000001
clrx
sta porta
stx porta
sta porta
stx porta
... etc for as many cycles as I needed (which weren't that many)
My busclk was the right speed to match the transducer.

Anyway, for this chip if you did it this way you could get 3.33MHz out of a pin. For a short while at least.

I believe this is the fastest way you can do it programmatically.
0 Kudos

474 Views
bigmac
Specialist III
Hello,
 
For uncontrolled, continuous output using a TPM, I would suspect that the maximum toggle rate is once per bus cycle, giving an output frequency of fbus/2.  Set up a TPM2 channel for edge aligned PWM, with TPM2MOD = 0x0001, and the timer channel value also set to 0x0001.
 
Once operational, no software interventions would be required.
 
Regards,
Mac
 
0 Kudos