How to output Synchronous Data for MC9S12NE64

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

How to output Synchronous Data for MC9S12NE64

1,250 Views
Chandra
Contributor I
Hi All,
I need to output synchronous data(data on one pin  and  clk on other) at 4.8Kbps /5.4 kbps from MC9S12NE64. Kindly suggest on how to do this ? Also a sample code will be helpful.
Kind Regards,
Chandra Prakash

Labels (1)
0 Kudos
1 Reply

284 Views
mjbcswitzerland
Specialist V
Hi Chandra

If the bus speed of the NE64 is 25MHz, the slowest clock which the SPI interface can generate is 12.21kHz and so is faster than the rate that you would like for your synchronous output. Running the NE64 at slower clock rates will not allow its Ethernet interface to work correctly.

It may be possible to use at timer interrupt to generate the clock timing and then 'bit-bang' the CLK and DATA lines at the speed which you require. This will involve an interrupt of around 100us period to produce a square wave on the clock line. If the external circuit can hanlde a pulse at the appropriate speed the interrupt could be reduced to half of the speed.

A further possibility would be to use the SPI in slave mode and drive its CLK input (output from the circuit) from a timer output. The timers can be programmed to generate an accurate frequency of 4800Hz (for example). By generating 8 pulses at the required frequency, an SPI byte can be clocked out of the SPI.

I am sorry but I don't have code to do these since it is a rather special solution but perhaps one of the methods will be appropriate for your needs.

Regards

Mark

www.uTasker.com

0 Kudos