[chbot] New chocolate fish challenge

William Fleete fleetwil at gmail.com
Wed Nov 19 04:47:42 GMT 2014

not sure if my first message got through but I had an idea of using a 6 bit counter in hardware either a ripple counter or using discrete logic, 6 lines for the binary count, 2 output to count and reset, which would use an 8 bit i/o bus and hence 1 byte of IO register, a bit of code to read and compare the input register, pulse the count output to inc, reset to bring it back to 0 and offer an output and flag for the "60 calls"
pseudo/BASIC code, I dont know C

set flag = 0 'set the flag back to 0 when the routine is called again
pulse output 01000000 	'inc hardware counter
read input 'read the IO register			

if input = 59 (00111011) then 'compare IO register to fixed value
	set output 10000000 'set the reset line for the ripple counter
	output reg bit -> flag 'transfer the reset line bit to the flag
	set output 0 'turn off the port
end if

9 lines of code 1 byte (9 bit) register for the IO and flag (8 for the output bus plus 1bit for the flag if that counts)  :) now wheres my chocolate fish :P

Sent from my iPad

> should be possible to build a 6 bit counter using xors and tests - basically making a counter using cascaded T type flip flops with lookahead carry etc. not sure if that can be done in 10 lines of code...
> I think the brain may need plugging in backwards for this one.
> -mark
> At 03:36 p.m. 19/11/2014, you wrote:
> [snip]
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Web site: http://kiwibots.org
> Meetings 3rd Monday each month.
> When replying, please edit your Subject line to reflect new content.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20141119/794f372b/attachment.html>

More information about the Chchrobotics mailing list