Processor: MC68HC11
I need help to write a program (assembly language) that generates a square signal with a frequency previously established. I am not sure if anyone is familiar with the FOX11 kit, but I want to use the parallel ports on that kit.
I would like it to take the input from a 4x4 keypad.  The numbers entered will be over 500 to represent the frequency generated.

I can do the 4x4 input, just need help with the logic of the code.
Any help?
Posted on 2009-06-25 05:56:53 by maxman
Easiest way to create a specific freq  is to loop N cycles, toggle output bit after that, read keyboard, jump to looping again.

unsigned char  period0,period1,period2;

// half_period = period0 + period1*256 + period2*256*256
// half_period = cpu_frequency * 2 / frequency

for(int i=0;i<period2;i++) wait64kCycles();
for(int i=0;i<period1;i++) wait256Cycles();
for(int i=0;i<period0;i++) {} // well, this needs specific tuning...

Posted on 2009-06-25 07:26:40 by Ultrano
I just have to figure this psuedocode out into the 68hc11 instruction set, any pointers?
Posted on 2009-06-25 09:09:30 by maxman