Updating output pins at speed
Posted: 30 June 2019, 14:50 PM
Pursuing my ongoing obsession with clock projects i decided to try and recreate an oscilloscope clock that was executed so well here
http://www.dutchtronix.com/ScopeClockH3-1-Enhanced.htm
I was intending to use a 328n but I note that there is not an entire output port of 8 pins available (to drive an external DAC AD7302) as for speed i was going to address the register directly such as:-
register.portb=255
but as an entire port is not available I've ended up with some code as below that users a pin map in an array where the pins could be any values.
With this code I can achieve approx 6,500 adc updates per second. If i remove the loop, i can achieve approx 30,000 but of course it doesn't work.
I could move to a zx40 as a solution or even a 128a1 I have which has the benefit of higher clock speed also, but i wondered if there was a simpler solution ?
http://www.dutchtronix.com/ScopeClockH3-1-Enhanced.htm
I was intending to use a 328n but I note that there is not an entire output port of 8 pins available (to drive an external DAC AD7302) as for speed i was going to address the register directly such as:-
register.portb=255
but as an entire port is not available I've ended up with some code as below that users a pin map in an array where the pins could be any values.
With this code I can achieve approx 6,500 adc updates per second. If i remove the loop, i can achieve approx 30,000 but of course it doesn't work.
I could move to a zx40 as a solution or even a 128a1 I have which has the benefit of higher clock speed also, but i wondered if there was a simpler solution ?
Code: Select all
'Sub to write the binary data to the correct pins
Sub ADC7302PutData(byVal byData as byte)
dim byLoop as Byte
for byLoop=0 to 7
Call PutPin(by7302Data(byLoop+1),GetBit(byData,byLoop))
'debug.print byLoop;" pin=";by7302Data(byLoop+1);" bit=";GetBit(byData,byLoop)
next
end sub