I want to make a simple dcc encoder (unlike the ledunino which does dcc decode), for a model railway/railroad dcc controller.
It needs to be able to send packets down a single wire where a binary 1 is a symetrical squarewave with a one wavelength period of 58 microseconds (f=17421Hz) and a binary 0 is twice as long at 116 microseconds (f=8620Hz). Both go between ±14v (that bit should be just a case of the correct driver circuit). Thing is , I don’t really want to expend to much arduino time generating these signals as the arduino needs to be able to respond to serial communication, do some calculation, create the data packets etc.
The packet itself contains 1111 1111 1111 110 <1Byte address> 0 <1 Byte Data> 0 <1 Byte Checksum> , obviously there can’t be any gaps in transmission between one bit and the next.
I need ideas as to what is the best way to generate the above signal, could some sort of audio chip do it? or would it be best to construct a pair of external oscilators to do the job with the arduino switching between them. Alternatively would it all be possible in software?
If anyone has any ideas/suggestions I’d be most greatful.